* [PATCH 1/6] docs: align nsenter.1 man page with howto-man-page.txt
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-20 18:04 ` [PATCH 2/6] build-sys: add nsenter to gitignore Sami Kerola
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Most visible change; the --target option has a path - explanation table
instead a long paragraph. This makes pairing of the information easier
for an average user such as me.
The rest of the changes are about aligning with howto, i.e., fix spaces
after dots, URL & mail address macros, remove inline emphasis where
possible, mark directory paths and words with underscore to be line
breakable, use optional option syntax from howto, cut line lenght to 80
chars.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/nsenter.1 | 201 ++++++++++++++++++++++++++++++++--------------------
1 file changed, 126 insertions(+), 75 deletions(-)
diff --git a/sys-utils/nsenter.1 b/sys-utils/nsenter.1
index 0fbb645..d133e1f 100644
--- a/sys-utils/nsenter.1
+++ b/sys-utils/nsenter.1
@@ -8,96 +8,147 @@ program
.RI [ arguments ]
.SH DESCRIPTION
Enters the contexts of one or more other processes and then executes specified
-program. Enterable namespaces are:
+program. Enterable namespaces are:
.TP
-.BR "mount namespace"
+.B mount namespace
mounting and unmounting filesystems will not affect rest of the system
-(\fBCLONE_NEWNS\fP flag), except for filesystems which are explicitly marked as
-shared (by mount --make-shared). See /proc/self/mountinfo for the shared flags.
+.RB ( CLONE_\:NEWNS
+flag), except for filesystems which are explicitly marked as shared (by mount
+--make-\:shared). See /proc\:/self\:/mountinfo for the shared flags.
.TP
-.BR "UTS namespace"
+.B UTS namespace
setting hostname, domainname will not affect rest of the system
-(\fBCLONE_NEWUTS\fP flag).
+.RB ( CLONE_\:NEWUTS
+flag).
.TP
-.BR "IPC namespace"
+.B IPC namespace
process will have independent namespace for System V message queues, semaphore
-sets and shared memory segments (\fBCLONE_NEWIPC\fP flag).
+sets and shared memory segments
+.RB ( CLONE_\:NEWIPC
+flag).
.TP
-.BR "network namespace"
+.B network namespace
process will have independent IPv4 and IPv6 stacks, IP routing tables, firewall
-rules, the \fI/proc/net\fP and \fI/sys/class/net\fP directory trees, sockets
-etc. (\fBCLONE_NEWNET\fP flag).
-.TP
-.BR "pid namespace"
+rules, the
+.I /proc\:/net
+and
+.I /sys\:/class\:/net
+directory trees, sockets etc.
+.RB ( CLONE_\:NEWNET
+flag).
+.TP
+.B pid namespace
children will have a distinct set of pid to process mappings thantheir parent.
-(\fBCLONE_NEWPID\fP flag).
+.RB ( CLONE_\:NEWPID
+flag).
.TP
-.BR "user namespace"
-process will have distinct set of uids, gids and capabilities. (\fBCLONE_NEWUSER\fP flag).
+.B user namespace
+process will have distinct set of uids, gids and capabilities.
+.RB ( CLONE_\:NEWUSER
+flag).
.TP
-See the \fBclone\fR(2) for exact semantics of the flags.
+See the
+.BR clone (2)
+for exact semantics of the flags.
.SH OPTIONS
-Note when specifying the optional \fB<file>\fP or \fB<directory>\fP arguments, the string
-of the option, equal sign (=), and the optional argument must not contain any blanks
-or other white space.
-.TP
-.BR \-h , " \-\-help"
-Print a help message,
-.TP
-.BR \-t , " \-\-target " \fIpid\fP
-Specify a target process to get contexts from. The paths to the contexts specified by pid are: /proc/[pid]/ns/mnt, /proc/[pid]/ns/uts, /proc/[pid]/ns/ipc, /proc/[pid]/ns/net, /proc/[pid]/ns/pid, /proc/[pid]/ns/user, /proc/[pid]/root, /proc/[pid]/cwd for the mount namespace, the uts namespace, the ipc namespace, the net namespace, the pid namespace, the user namespace, the root directory and the working directory respectively.
-.TP
-.BR \-m , " \-\-mount"[=\fIfile\fP]
-Enter the mount namespace.
-If no file is specified enter the mount namespace of the target process.
-If file is specified enter the mount namespace specified by file.
-.TP
-.BR \-u , " \-\-uts"[=\fIfile\fP]
-Enter the uts namespace.
-If no file is specified enter the uts namespace of the target process.
-If file is specified enter the uts namespace specified by file.
-.TP
-.BR \-i , " \-\-ipc"[=\fIfile\fP]
-Enter the IPC namespace.
-If no file is specified enter the IPC namespace of the target process.
-If file is specified enter the uts namespace specified by file.
-.TP
-.BR \-n , " \-\-net"[=\fIfile\fP]
-Enter the network namespace.
-If no file is specified enter the network namespace of the target process.
-If file is specified enter the network namespace specified by file.
-.TP
-.BR \-p , " \-\-pid"[=\fIfile\fP]
-Enter the pid namespace.
-If no file is specified enter the pid namespace of the target process.
-If file is specified enter the pid namespace specified by file.
-.TP
-.BR \-U , " \-\-user"[=\fIfile\fP]
-Enter the user namespace.
-If no file is specified enter the user namespace of the target process.
-If file is specified enter the user namespace specified by file.
-.TP
-.BR \-r , " \-\-root"[=\fIdirectory\fP]
-Set the root directory.
-If no directory is specified set the root directory to the root directory of the target process.
-If directory is specified set the root directory to the specified directory.
-.TP
-.BR \-w , " \-\-wd"[=\fIdirectory\fP]
-Set the working directory.
-If no directory is specified set the working directory to the working directory of the target process.
-If directory is specified set the working directory to the specified directory.
-.TP
-.BR \-e , " \-\-exec"
-Don't fork before exec'ing the specified program. By default when entering
-a pid namespace enter calls fork before calling exec so that the children will
-be in the newly entered pid namespace.
+Argument with square brakets, such as [\fIfile\fR], means optional argument.
+Command line syntax to specify optional argument \-\-mount=/path\:/to\:/file.
+Please notice the equals sign.
+.TP
+\fB\-t\fR, \fB\-\-target\fR \fIpid\fP
+Specify a target process to get contexts from. The paths to the contexts
+specified by
+.I pid
+are:
+.RS
+.PD 0
+.IP "" 20
+.TP
+/proc/\fIpid\fR/ns/mnt
+the mount namespace
+.TP
+/proc/\fIpid\fR/ns/uts
+the uts namespace
+.TP
+/proc/\fIpid\fR/ns/ipc
+the ipc namespace
+.TP
+/proc/\fIpid\fR/ns/net
+the ipc namespace
+.TP
+/proc/\fIpid\fR/ns/pid
+the pid namespace
+.TP
+/proc/\fIpid\fR/ns/user
+the user namespace
+.TP
+/proc/\fIpid\fR/root
+the root directory
+.TP
+/proc/\fIpid\fR/cw
+the working directory respectively
+.PD
+.RE
+.TP
+\fB\-m\fR, \fB\-\-mount\fR [\fIfile\fR]
+Enter the mount namespace. If no file is specified enter the mount namespace
+of the target process. If file is specified enter the mount namespace
+specified by file.
+.TP
+\fB\-u\fR, \fB\-\-uts\fR [\fIfile\fR]
+Enter the uts namespace. If no file is specified enter the uts namespace of
+the target process. If file is specified enter the uts namespace specified by
+file.
+.TP
+\fB\-i\fR, \fB\-\-ipc\fR [\fIfile\fR]
+Enter the IPC namespace. If no file is specified enter the IPC namespace of
+the target process. If file is specified enter the uts namespace specified by
+file.
+.TP
+\fB\-n\fR, \fB\-\-net\fR [\fIfile\fR]
+Enter the network namespace. If no file is specified enter the network
+namespace of the target process. If file is specified enter the network
+namespace specified by file.
+.TP
+\fB\-p\fR, \fB\-\-pid\fR [\fIfile\fR]
+Enter the pid namespace. If no file is specified enter the pid namespace of
+the target process. If file is specified enter the pid namespace specified by
+file.
+.TP
+\fB\-U\fR, \fB\-\-user\fR [\fIfile\fR]
+Enter the user namespace. If no file is specified enter the user namespace of
+the target process. If file is specified enter the user namespace specified by
+file.
+.TP
+\fB\-r\fR, \fB\-\-root\fR [\fIdirectory\fR]
+Set the root directory. If no directory is specified set the root directory to
+the root directory of the target process. If directory is specified set the
+root directory to the specified directory.
+.TP
+\fB\-w\fR, \fB\-\-wd\fR [\fIdirectory\fR]
+Set the working directory. If no directory is specified set the working
+directory to the working directory of the target process. If directory is
+specified set the working directory to the specified directory.
+.TP
+\fB\-e\fR, \fB\-\-exec\fR
+Do not fork before exec'ing the specified program. By default when entering a
+pid namespace enter calls fork before calling exec so that the children will be
+in the newly entered pid namespace.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display version information and exit.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Print a help message.
.SH SEE ALSO
.BR setns (2),
.BR clone (2)
-.SH BUGS
-None known so far.
.SH AUTHOR
-Eric Biederman <ebiederm@xmission.com>
+.MT ebiederm@xmission.com
+Eric Biederman
+.ME
.SH AVAILABILITY
The nsenter command is part of the util-linux package and is available from
-ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
+.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
+Linux Kernel Archive
+.UE .
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/6] build-sys: add nsenter to gitignore
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
2013-01-20 18:04 ` [PATCH 1/6] docs: align nsenter.1 man page with howto-man-page.txt Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-20 18:04 ` [PATCH 3/6] nsenter: adjust few error messages Sami Kerola
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index e85eb07..dbcf0b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,6 +127,7 @@ tests/run.sh.trs
/mountpoint
/namei
/newgrp
+/nsenter
/partx
/pg
/pivot_root
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/6] nsenter: adjust few error messages
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
2013-01-20 18:04 ` [PATCH 1/6] docs: align nsenter.1 man page with howto-man-page.txt Sami Kerola
2013-01-20 18:04 ` [PATCH 2/6] build-sys: add nsenter to gitignore Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-20 18:04 ` [PATCH 4/6] nsenter: fix compiler warning Sami Kerola
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
The 'neither filename nor target' is changed to use errx() rather than
err(), because the errno is indicating success at the time of fatal error
which is wrong message for an user.
The "cannot open %s" is same string as in other files, making translators
to work less.
Remaining changes aim to ease understanding what went wrong for a
non-programmer audience.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/nsenter.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index ce2c64d..ec8600a 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -94,7 +94,7 @@ static void open_target_fd(int *fd, const char *type, const char *path)
path = pathbuf;
}
if (!path)
- err(EXIT_FAILURE, _("No filename and no target pid supplied for %s"),
+ errx(EXIT_FAILURE, _("neither filename nor target pid supplied for %s"),
type);
if (*fd >= 0)
@@ -102,7 +102,7 @@ static void open_target_fd(int *fd, const char *type, const char *path)
*fd = open(path, O_RDONLY);
if (*fd < 0)
- err(EXIT_FAILURE, _("open of '%s' failed"), path);
+ err(EXIT_FAILURE, _("cannot open %s"), path);
}
static void open_namespace_fd(int nstype, const char *path)
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
if (nsfile->fd < 0)
continue;
if (setns(nsfile->fd, nsfile->nstype))
- err(EXIT_FAILURE, _("setns of '%s' failed"),
+ err(EXIT_FAILURE, _("reassociate to namespace '%s' failed"),
nsfile->name);
close(nsfile->fd);
nsfile->fd = -1;
@@ -243,13 +243,13 @@ int main(int argc, char *argv[])
if (root_fd >= 0 && wd_fd < 0) {
wd_fd = open(".", O_RDONLY);
if (wd_fd < 0)
- err(EXIT_FAILURE, _("open of . failed"));
+ err(EXIT_FAILURE, _("cannot open current working directory"));
}
/* Change the root directory */
if (root_fd >= 0) {
if (fchdir(root_fd) < 0)
- err(EXIT_FAILURE, _("fchdir to root_fd failed"));
+ err(EXIT_FAILURE, _("change directory by root file descriptor failed"));
if (chroot(".") < 0)
err(EXIT_FAILURE, _("chroot failed"));
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
/* Change the working directory */
if (wd_fd >= 0) {
if (fchdir(wd_fd) < 0)
- err(EXIT_FAILURE, _("fchdir to wd_fd failed"));
+ err(EXIT_FAILURE, _("change directory by working directory file descriptor failed"));
close(wd_fd);
wd_fd = -1;
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/6] nsenter: fix compiler warning
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
` (2 preceding siblings ...)
2013-01-20 18:04 ` [PATCH 3/6] nsenter: adjust few error messages Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-20 18:04 ` [PATCH 5/6] nsenter: drop core when impossible happens Sami Kerola
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
nsenter.c:53:2: warning: ISO C forbids empty initializer braces [-pedantic]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/nsenter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index ec8600a..b83f457 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -50,7 +50,7 @@ static struct namespace_file{
{ .nstype = CLONE_NEWNET, .name = "ns/net", .fd = -1 },
{ .nstype = CLONE_NEWPID, .name = "ns/pid", .fd = -1 },
{ .nstype = CLONE_NEWNS, .name = "ns/mnt", .fd = -1 },
- {}
+ { .nstype = 0, .name = NULL, .fd = 0 }
};
static void usage(int status)
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 5/6] nsenter: drop core when impossible happens
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
` (3 preceding siblings ...)
2013-01-20 18:04 ` [PATCH 4/6] nsenter: fix compiler warning Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-20 18:04 ` [PATCH 6/6] nsenter: fix indentation Sami Kerola
2013-01-25 14:52 ` [PATCH 0/6] pull: nsenter: trivial adjustments Karel Zak
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Message to user is less informative, but impossible events should be
rare so core files are much appriciated for these cases.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/nsenter.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index b83f457..0e1c8f4 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <assert.h>
#include "strutils.h"
#include "nls.h"
@@ -117,7 +118,7 @@ static void open_namespace_fd(int nstype, const char *path)
return;
}
/* This should never happen */
- err(EXIT_FAILURE, "Unrecognized namespace type");
+ assert(nsfile->nstype);
}
static void continue_as_child(void)
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 6/6] nsenter: fix indentation
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
` (4 preceding siblings ...)
2013-01-20 18:04 ` [PATCH 5/6] nsenter: drop core when impossible happens Sami Kerola
@ 2013-01-20 18:04 ` Sami Kerola
2013-01-25 14:52 ` [PATCH 0/6] pull: nsenter: trivial adjustments Karel Zak
6 siblings, 0 replies; 8+ messages in thread
From: Sami Kerola @ 2013-01-20 18:04 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
include/namespace.h | 55 ++++++++++++++++++++++++++---------------------------
sys-utils/nsenter.c | 35 ++++++++++++++++++++--------------
2 files changed, 48 insertions(+), 42 deletions(-)
diff --git a/include/namespace.h b/include/namespace.h
index 8ccc3f6..3a219ce 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -1,43 +1,42 @@
/* Compat code so unshare and setns can be used with older libcs */
#ifndef UTIL_LINUX_NAMESPACE_H
-#define UTIL_LINUX_NAMESPACE_H
+# define UTIL_LINUX_NAMESPACE_H
-#include <sched.h>
+# include <sched.h>
-#ifndef CLONE_NEWSNS
-# define CLONE_NEWNS 0x00020000
-#endif
-#ifndef CLONE_NEWUTS
-# define CLONE_NEWUTS 0x04000000
-#endif
-#ifndef CLONE_NEWIPC
-# define CLONE_NEWIPC 0x08000000
-#endif
-#ifndef CLONE_NEWNET
-# define CLONE_NEWNET 0x40000000
-#endif
-#ifndef CLONE_NEWUSER
-# define CLONE_NEWUSER 0x10000000
-#endif
-#ifndef CLONE_NEWPID
-# define CLONE_NEWPID 0x20000000
-#endif
-
-#ifndef HAVE_UNSHARE
-# include <sys/syscall.h>
+# ifndef CLONE_NEWSNS
+# define CLONE_NEWNS 0x00020000
+# endif
+# ifndef CLONE_NEWUTS
+# define CLONE_NEWUTS 0x04000000
+# endif
+# ifndef CLONE_NEWIPC
+# define CLONE_NEWIPC 0x08000000
+# endif
+# ifndef CLONE_NEWNET
+# define CLONE_NEWNET 0x40000000
+# endif
+# ifndef CLONE_NEWUSER
+# define CLONE_NEWUSER 0x10000000
+# endif
+# ifndef CLONE_NEWPID
+# define CLONE_NEWPID 0x20000000
+# endif
+# ifndef HAVE_UNSHARE
+# include <sys/syscall.h>
static inline int unshare(int flags)
{
return syscall(SYS_unshare, flags);
}
-#endif
+# endif
-#ifndef HAVE_SETNS
-# include <sys/syscall.h>
+# ifndef HAVE_SETNS
+# include <sys/syscall.h>
static inline int setns(int fd, int nstype)
{
return syscall(SYS_setns, fd, nstype);
}
-#endif /* HAVE_SETNS */
+# endif
-#endif /* UTIL_LINUX_NAMESPACE_H */
+#endif /* UTIL_LINUX_NAMESPACE_H */
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index 0e1c8f4..04ac314 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -34,7 +34,7 @@
#include "closestream.h"
#include "namespace.h"
-static struct namespace_file{
+static struct namespace_file {
int nstype;
const char *name;
int fd;
@@ -91,12 +91,13 @@ static void open_target_fd(int *fd, const char *type, const char *path)
if (!path && namespace_target_pid) {
snprintf(pathbuf, sizeof(pathbuf), "/proc/%u/%s",
- namespace_target_pid, type);
+ namespace_target_pid, type);
path = pathbuf;
}
if (!path)
- errx(EXIT_FAILURE, _("neither filename nor target pid supplied for %s"),
- type);
+ errx(EXIT_FAILURE,
+ _("neither filename nor target pid supplied for %s"),
+ type);
if (*fd >= 0)
close(*fd);
@@ -147,8 +148,7 @@ static void continue_as_child(void)
/* Return the child's exit code if possible */
if (WIFEXITED(status)) {
exit(WEXITSTATUS(status));
- }
- else if (WIFSIGNALED(status)) {
+ } else if (WIFSIGNALED(status)) {
kill(getpid(), WTERMSIG(status));
}
exit(EXIT_FAILURE);
@@ -181,15 +181,18 @@ int main(int argc, char *argv[])
textdomain(PACKAGE);
atexit(close_stdout);
- while((c = getopt_long(argc, argv, "hVt:m::u::i::n::p::U::er::w::", longopts, NULL)) != -1) {
- switch(c) {
+ while ((c =
+ getopt_long(argc, argv, "hVt:m::u::i::n::p::U::er::w::",
+ longopts, NULL)) != -1) {
+ switch (c) {
case 'h':
usage(EXIT_SUCCESS);
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 't':
- namespace_target_pid = strtoul_or_err(optarg, _("failed to parse pid"));
+ namespace_target_pid =
+ strtoul_or_err(optarg, _("failed to parse pid"));
break;
case 'm':
open_namespace_fd(CLONE_NEWNS, optarg);
@@ -224,7 +227,7 @@ int main(int argc, char *argv[])
}
}
- if(optind >= argc)
+ if (optind >= argc)
usage(EXIT_FAILURE);
/*
@@ -234,7 +237,8 @@ int main(int argc, char *argv[])
if (nsfile->fd < 0)
continue;
if (setns(nsfile->fd, nsfile->nstype))
- err(EXIT_FAILURE, _("reassociate to namespace '%s' failed"),
+ err(EXIT_FAILURE,
+ _("reassociate to namespace '%s' failed"),
nsfile->name);
close(nsfile->fd);
nsfile->fd = -1;
@@ -244,13 +248,15 @@ int main(int argc, char *argv[])
if (root_fd >= 0 && wd_fd < 0) {
wd_fd = open(".", O_RDONLY);
if (wd_fd < 0)
- err(EXIT_FAILURE, _("cannot open current working directory"));
+ err(EXIT_FAILURE,
+ _("cannot open current working directory"));
}
/* Change the root directory */
if (root_fd >= 0) {
if (fchdir(root_fd) < 0)
- err(EXIT_FAILURE, _("change directory by root file descriptor failed"));
+ err(EXIT_FAILURE,
+ _("change directory by root file descriptor failed"));
if (chroot(".") < 0)
err(EXIT_FAILURE, _("chroot failed"));
@@ -262,7 +268,8 @@ int main(int argc, char *argv[])
/* Change the working directory */
if (wd_fd >= 0) {
if (fchdir(wd_fd) < 0)
- err(EXIT_FAILURE, _("change directory by working directory file descriptor failed"));
+ err(EXIT_FAILURE,
+ _("change directory by working directory file descriptor failed"));
close(wd_fd);
wd_fd = -1;
--
1.8.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 0/6] pull: nsenter: trivial adjustments
2013-01-20 18:04 [PATCH 0/6] pull: nsenter: trivial adjustments Sami Kerola
` (5 preceding siblings ...)
2013-01-20 18:04 ` [PATCH 6/6] nsenter: fix indentation Sami Kerola
@ 2013-01-25 14:52 ` Karel Zak
6 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2013-01-25 14:52 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Jan 20, 2013 at 06:04:50PM +0000, Sami Kerola wrote:
> Sami Kerola (6):
> docs: align nsenter.1 man page with howto-man-page.txt
> build-sys: add nsenter to gitignore
> nsenter: adjust few error messages
> nsenter: fix compiler warning
> nsenter: drop core when impossible happens
> nsenter: fix indentation
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 8+ messages in thread