On Mon, Jan 07, 2013 at 03:05:23PM +0100, Karel Zak wrote: > On Fri, Dec 28, 2012 at 11:22:18AM -0500, Neil Horman wrote: > > sys-utils/unshare.1 | 34 +++++++++++++++--------- > > sys-utils/unshare.c | 74 ++++++++++++++++++++++++++++++++++++++++++----------- > > 2 files changed, 81 insertions(+), 27 deletions(-) > > Applied with some changes, please check/verify the changes in git, thanks. > > > +static void close_files(void) > > +{ > > + int i; > > + for (i=0; ns_pids[i] > 0; i++) > > + close(ns_pids[i]); > > + close_stdout(); > > +} > > this is unnecessary, but O_CLOEXEC is probably good idea > > > + while((c = getopt_long(argc, argv, "hVm:u:i:n:", longopts, NULL)) != -1) { > > + ns = NULL; > > optional argument means "::" not ":" > > > + if (optarg && ns) { > > + if (nscount >= NUM_ENTRIES) > > + err(EXIT_FAILURE, _("Too many new namespaces specified")); > > + pid = strtoul(optarg, NULL, 10); > > for the short options the 'optarg' starts with '=', so you need > optarg++ > > > + for (nscount = 0; ns_pids[nscount] > 0; nscount++) > > + if (-1 == setns(ns_pids[nscount], 0)) > > + err(EXIT_FAILURE, _("setns failed")); > > + > > if(-1 == unshare(unshare_flags)) > > err(EXIT_FAILURE, _("unshare failed")); > > it seems that unshare() should not be called if unshare_flags == 0 Your changes look fine. FWIW, theres no need to check that unshare_flags is 0 (not that it matters if you do). The man page documents (and the implementation inforces that unshare(0) is a no-op. Thanks! Neil > > Karel > > -- > Karel Zak <kzak@xxxxxxxxxx> > http://karelzak.blogspot.com > -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html