From: Sami Kerola Date: Fri, 12 Oct 2012 19:23:54 +0000 (+0100) Subject: libmount, eject: replace index() and rindex() with strrch() or strrchr() X-Git-Tag: v2.23-rc1~592 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=913e43b8e2dedbac69880e26fc1eead509fb666e;p=thirdparty%2Futil-linux.git libmount, eject: replace index() and rindex() with strrch() or strrchr() Both index() and rindex() are legacy functions which may be withdrawn in a future. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/index.html Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/rindex.html Acked-by: Mike Frysinger Signed-off-by: Sami Kerola --- diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c index 463c884e3b..2cae750dc2 100644 --- a/libmount/src/tab_parse.c +++ b/libmount/src/tab_parse.c @@ -362,14 +362,14 @@ next_line: if (fgets(buf, sizeof(buf), f) == NULL) return -EINVAL; ++*nlines; - s = index (buf, '\n'); + s = strchr (buf, '\n'); if (!s) { /* Missing final newline? Otherwise extremely */ /* long line - assume file was corrupted */ if (feof(f)) { DBG(TAB, mnt_debug_h(tb, "%s: no final newline", filename)); - s = index (buf, '\0'); + s = strchr (buf, '\0'); } else { DBG(TAB, mnt_debug_h(tb, "%s:%d: missing newline at line", diff --git a/sys-utils/eject.c b/sys-utils/eject.c index 1a5b834096..5d5d7b18b3 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -499,7 +499,7 @@ static int read_speed(const char *devname) if (!f) err(EXIT_FAILURE, _("cannot open %s"), _PATH_PROC_CDROMINFO); - name = rindex(devname, '/') + 1; + name = strrchr(devname, '/') + 1; while (name && !feof(f)) { char line[512];