- INFO("exec-ing %s\n", *opts.jail_argv);
- execve(*opts.jail_argv, opts.jail_argv, envp);
- /* we get there only if execve fails */
- ERROR("failed to execve %s: %s\n", *opts.jail_argv, strerror(errno));
- exit(EXIT_FAILURE);
-}
-
-static int spawn_jail(void *_notused)
-{
- if (opts.name && sethostname(opts.name, strlen(opts.name))) {
- ERROR("failed to sethostname: %s\n", strerror(errno));
+ if (opts.namespace && opts.hostname && strlen(opts.hostname) > 0
+ && sethostname(opts.hostname, strlen(opts.hostname))) {
+ ERROR("sethostname(%s) failed: %s\n", opts.hostname, strerror(errno));
+ exit(EXIT_FAILURE);