aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2015-02-08 20:44:40 +0000
committerKarel Zak <kzak@redhat.com>2015-02-10 13:21:23 +0100
commit2fc5a0d5bc3609d69863ba45de850e659d5e60f6 (patch)
tree1878abd69ea1012c210f3e5d87121627d0cb3124
parent4863ddaddf6ca5b21c1041b8c875b7211f4ac4e9 (diff)
downloadutil-linux-playground-2fc5a0d5bc3609d69863ba45de850e659d5e60f6.tar.gz
rename: use strrchr() instead of rindex()
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>
-rw-r--r--misc-utils/rename.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index f9cc3a5d25..7ac068d639 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -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))