Quoting Stéphane Graber (stgra...@ubuntu.com): > The two functions are identical but strrchr also works on Bionic.
But I like 'rindex' so much better :) > > Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > --- > src/lxc/bdev.c | 12 ++++++------ > src/lxc/cgroup.c | 4 ++-- > src/lxc/lxccontainer.c | 6 +++--- > 3 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c > index c96ccfe..e244550 100644 > --- a/src/lxc/bdev.c > +++ b/src/lxc/bdev.c > @@ -540,7 +540,7 @@ static int zfs_clone(const char *opath, const char > *npath, const char *oname, > if ((p = index(output, ' ')) == NULL) > return -1; > *p = '\0'; > - if ((p = rindex(output, '/')) == NULL) > + if ((p = strrchr(output, '/')) == NULL) > return -1; > *p = '\0'; > } else > @@ -796,14 +796,14 @@ static int do_lvm_create(const char *path, unsigned > long size) > 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++; > @@ -831,7 +831,7 @@ static int lvm_snapshot(const char *orig, const char > *path, unsigned long size) > pathdup = strdup(path); > if (!pathdup) > exit(1); > - lv = rindex(pathdup, '/'); > + lv = strrchr(pathdup, '/'); > if (!lv) { > free(pathdup); > exit(1); > @@ -1139,7 +1139,7 @@ static int btrfs_subvolume_create(const char *path) > return -1; > } > > - p = rindex(newfull, '/'); > + p = strrchr(newfull, '/'); > if (!p) { > ERROR("bad path: %s", path); > return -1; > @@ -1266,7 +1266,7 @@ static int btrfs_destroy(struct bdev *orig) > return -1; > } > > - p = rindex(newfull, '/'); > + p = strrchr(newfull, '/'); > if (!p) { > ERROR("bad path: %s", path); > return -1; > diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c > index 78083e8..b2b1aa3 100644 > --- a/src/lxc/cgroup.c > +++ b/src/lxc/cgroup.c > @@ -249,7 +249,7 @@ char *lxc_cgroup_path_get(const char *subsystem, const > char *name, > 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); > } > @@ -848,7 +848,7 @@ static char *find_free_cgroup(struct cgroup_desc *d, > const char *lxc_name) > } > // 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; > } > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c > index 6cf3da6..a64babe 100644 > --- a/src/lxc/lxccontainer.c > +++ b/src/lxc/lxccontainer.c > @@ -1645,7 +1645,7 @@ static int copyhooks(struct lxc_container *oldc, struct > lxc_container *c) > 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; > @@ -1706,7 +1706,7 @@ static int copy_fstab(struct lxc_container *oldc, > struct lxc_container *c) > if (!oldpath) > return 0; > > - char *p = rindex(oldpath, '/'); > + char *p = strrchr(oldpath, '/'); > if (!p) > return -1; > ret = snprintf(newpath, MAXPATHLEN, "%s/%s%s", > @@ -1845,7 +1845,7 @@ only rootfs gets converted (copied/snapshotted) on > clone. > > static int create_file_dirname(char *path) > { > - char *p = rindex(path, '/'); > + char *p = strrchr(path, '/'); > int ret; > > if (!p) > -- > 1.8.3.2 > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite! > It's a free troubleshooting tool designed for production. > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel