On Fri, May 01, 2009 at 05:55:22PM +0700, Mikhail Gusarov wrote: > +int main(int argc, char **argv) > +{ > + const char *prgname = argv[0]; > + > + if (argc < 3) { > + fprintf(stderr, "Usage: %s <hostname> <program> [<program args>]\n", > + prgname); > + exit(1); > + } > + > + if (unshare(CLONE_NEWUTS)) { > + fprintf(stderr, "%s: Unable to create new utsname namespace: %s\n", > + prgname, strerror(errno)); > + exit(1); > + } > + > + if (sethostname(argv[1], strlen(argv[1]))) { > + fprintf(stderr, "%s: Unable to set hostname: %s\n", > + prgname, strerror(errno)); > + exit(1); > + } Do we really need to call sethostname() here? We have hostname(1) utility and I don't think we need to duplicate this functionality. IMHO everything what we need is to create a new namespace (= call unshare(2)) -- the full environment setup shouldn't be our goal. KISS principle... Karel -- Karel Zak <kzak@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html