]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rename: use strrchr() instead of rindex()
authorSami Kerola <kerolasa@iki.fi>
Sun, 8 Feb 2015 20:44:40 +0000 (20:44 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Feb 2015 12:21:23 +0000 (13:21 +0100)
The rindex() is marked legacy in POSIX.1-2001, and apparently Androids
bionic libc does not even have it so it is best not to use the legacy
interface.

Reference: https://lists.gnu.org/archive/html/weechat-dev/2014-02/msg00004.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
misc-utils/rename.c

index f9cc3a5d25292009845854ac1b9e20780b5d58f4..7ac068d639eee19811a0dbe32075d86586b111f5 100644 (file)
@@ -95,7 +95,7 @@ static int do_file(char *from, char *to, char *s, int verbose)
        char *newname = NULL, *file;
        int ret = 1;
 
-       file = rindex(s, '/');
+       file = strrchr(s, '/');
        if (file == NULL)
                file = s;
        if (string_replace(from, to, file, s, &newname))