Le 04/10/2018 à 12:11, Karel Zak a écrit : > 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 Yes, the idea was to switch to a working directory in the chroot case. But if you think it can be useful to switch to another directory on the non-chroot case, I can upgrade the patch as you say. Thanks, Laurent > 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 >