diff options
-rw-r--r-- | src/libvirt.c | 2 | ||||
-rw-r--r-- | tools/virt-login-shell.c | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/libvirt.c b/src/libvirt.c index d76e537c7f..77ae358d8f 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -409,7 +409,7 @@ virGlobalInit(void) virErrorInitialize() < 0) goto error; -#ifndef IN_VIRT_LOGIN_SHELL +#ifndef LIBVIRT_SETUID_RPC_CLIENT if (virIsSUID()) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libvirt.so is not safe to use from setuid programs")); diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index 758d1af17f..361ba9c303 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -1,7 +1,7 @@ /* * virt-login-shell.c: a shell to connect to a container * - * Copyright (C) 2013 Red Hat, Inc. + * Copyright (C) 2013-2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -317,15 +317,6 @@ main(int argc, char **argv) int openmax = sysconf(_SC_OPEN_MAX); int fd; - if (openmax < 0) { - virReportSystemError(errno, "%s", - _("sysconf(_SC_OPEN_MAX) failed")); - return EXIT_FAILURE; - } - for (fd = 3; fd < openmax; fd++) { - int tmpfd = fd; - VIR_MASS_CLOSE(tmpfd); - } /* Fork once because we don't want to affect * virt-login-shell's namespace itself @@ -354,6 +345,16 @@ main(int argc, char **argv) if (ret < 0) return EXIT_FAILURE; + if (openmax < 0) { + virReportSystemError(errno, "%s", + _("sysconf(_SC_OPEN_MAX) failed")); + return EXIT_FAILURE; + } + for (fd = 3; fd < openmax; fd++) { + int tmpfd = fd; + VIR_MASS_CLOSE(tmpfd); + } + if (virFork(&ccpid) < 0) return EXIT_FAILURE; |