This is shorter code and makes things a bit clearer and less
error prone if anyone happens to copy the code.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
#include <stdlib.h>
#include <unistd.h>
+#include "strutils.h"
#include "nls.h"
#include "c.h"
#include "closestream.h"
struct namespace_file *nsfile;
int do_fork = 0;
- char *end;
int c;
setlocale(LC_MESSAGES, "");
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 't':
- errno = 0;
- namespace_target_pid = strtoul(optarg, &end, 10);
- if (!*optarg || (*optarg && *end) || errno != 0) {
- err(EXIT_FAILURE,
- _("Pid '%s' is not a valid number"),
- optarg);
- }
+ namespace_target_pid = strtoul_or_err(optarg, _("failed to parse pid"));
break;
case 'm':
open_namespace_fd(CLONE_NEWNS, optarg);