The two functions are identical but strrchr also works on Bionic.
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
if ((p = index(output, ' ')) == NULL)
return -1;
*p = '\0';
- if ((p = rindex(output, '/')) == NULL)
+ if ((p = strrchr(output, '/')) == NULL)
return -1;
*p = '\0';
} else
pathdup = strdup(path);
if (!pathdup)
exit(1);
- lv = rindex(pathdup, '/');
+ lv = strrchr(pathdup, '/');
if (!lv) {
free(pathdup);
exit(1);
}
*lv = '\0';
lv++;
- vg = rindex(pathdup, '/');
+ vg = strrchr(pathdup, '/');
if (!vg)
exit(1);
vg++;
pathdup = strdup(path);
if (!pathdup)
exit(1);
- lv = rindex(pathdup, '/');
+ lv = strrchr(pathdup, '/');
if (!lv) {
free(pathdup);
exit(1);
return -1;
}
- p = rindex(newfull, '/');
+ p = strrchr(newfull, '/');
if (!p) {
ERROR("bad path: %s", path);
return -1;
return -1;
}
- p = rindex(newfull, '/');
+ p = strrchr(newfull, '/');
if (!p) {
ERROR("bad path: %s", path);
return -1;
return strdup("/");
}
// path still has 'tasks' on the end, drop it
- if ((p = rindex(path, '/')) != NULL)
+ if ((p = strrchr(path, '/')) != NULL)
*p = '\0';
return strdup(path);
}
}
// found it
// path has '/tasks' at end, drop that
- if (!(cgp = rindex(path, '/'))) {
+ if (!(cgp = strrchr(path, '/'))) {
ERROR("Got nonsensical path name %s\n", path);
return NULL;
}
for (i=0; i<NUM_LXC_HOOKS; i++) {
lxc_list_for_each(it, &c->lxc_conf->hooks[i]) {
char *hookname = it->elem;
- char *fname = rindex(hookname, '/');
+ char *fname = strrchr(hookname, '/');
char tmppath[MAXPATHLEN];
if (!fname) // relative path - we don't support, but maybe we should
return 0;
if (!oldpath)
return 0;
- char *p = rindex(oldpath, '/');
+ char *p = strrchr(oldpath, '/');
if (!p)
return -1;
ret = snprintf(newpath, MAXPATHLEN, "%s/%s%s",
static int create_file_dirname(char *path)
{
- char *p = rindex(path, '/');
+ char *p = strrchr(path, '/');
int ret;
if (!p)