On Fri, Sep 28, 2018 at 02:45:11PM +0200, Laurent Vivier wrote: > + if (newroot) { > + if (chroot(newroot) != 0) > + err(EXIT_FAILURE, > + _("cannot change root directory to '%s'"), newroot); > + if (chdir(newdir)) > + err(EXIT_FAILURE, _("cannot chdir to '%s'"), newdir); > + } It means that --wd is usable only when --root is specified. Is it expected? Would be better to use char *newdir = NULL; while ((c = getopt_long(....))) { ... case 'w': newdir = optarg; break; } ... if (newroot) { if (chroot(newroot)) ... error ... if (chdir(newdir ? newdir : "/")) ... error ... } else if (newdir && chdir(newdir)) ... error ... Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com