From 1ab32c39d00a912ab14636b3d048e2008d37fa08 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Fri, 15 Jan 2021 20:22:22 +0100 Subject: [PATCH] Merge all the various definitions of the err variable --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 29ceb98..d24960c 100644 --- a/main.c +++ b/main.c @@ -62,6 +62,7 @@ char** argdup(int argc, const char** argv) int main(int argc, const char** argv) { + int err; if (argc == 1) { printf("Usage: pidjail PROGRAM ARGUMENTS...\n" @@ -72,7 +73,7 @@ int main(int argc, const char** argv) // next fork shall be in a new pid namespace if (unshare(CLONE_NEWPID) != 0) { - int err = errno; + err = errno; printf("Failed to unshare pid namespace (%d)\n", err); return err; } @@ -102,7 +103,7 @@ int main(int argc, const char** argv) int status; if (waitpid(pid, &status, 0) == -1) { - int err = errno; + err = errno; printf("Failed to wait (%d)\n", err); return err; } @@ -123,7 +124,6 @@ int main(int argc, const char** argv) pid_t first_child = pid; pid_t exited_child; int child_status; - int err; // Setup forward for SIGTERM pid_child = first_child; @@ -157,8 +157,8 @@ int main(int argc, const char** argv) if (execvp(newargs[0], newargs) == -1) { - printf("Failed to exec (%d)\n", errno); - return errno; + printf("Failed to exec (%d)\n", err); + return err; } } }