[PATCH 1/2] rename: use strrchr() instead of rindex()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 misc-utils/rename.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index f9cc3a5..7ac068d 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))
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux