aboutgitcodebugslistschat
path: root/pasta.c
diff options
context:
space:
mode:
authorLaine Stump <laine@redhat.com>2023-02-15 03:24:37 -0500
committerStefano Brivio <sbrivio@redhat.com>2023-02-16 17:32:27 +0100
commitc9af6f92db9f760e0b03a75bf688439e4aeab231 (patch)
tree88807dd9f5aa5b0379d792ac1ec1fc15bf1f4eb3 /pasta.c
parenta1ab1ca2eedbc16139cf03df06c6012b22f1f2cb (diff)
downloadpasst-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar.gz
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar.bz2
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar.lz
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar.xz
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.tar.zst
passt-c9af6f92db9f760e0b03a75bf688439e4aeab231.zip
convert all remaining err() followed by exit() to die()
This actually leaves us with 0 uses of err(), but someone could want to use it in the future, so we may as well leave it around. Signed-off-by: Laine Stump <laine@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pasta.c')
-rw-r--r--pasta.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/pasta.c b/pasta.c
index d4d3dc8..6c9a412 100644
--- a/pasta.c
+++ b/pasta.c
@@ -131,19 +131,15 @@ void pasta_open_ns(struct ctx *c, const char *netns)
int nfd = -1;
nfd = open(netns, O_RDONLY | O_CLOEXEC);
- if (nfd < 0) {
- err("Couldn't open network namespace %s", netns);
- exit(EXIT_FAILURE);
- }
+ if (nfd < 0)
+ die("Couldn't open network namespace %s", netns);
c->pasta_netns_fd = nfd;
NS_CALL(ns_check, c);
- if (c->pasta_netns_fd < 0) {
- err("Couldn't switch to pasta namespaces");
- exit(EXIT_FAILURE);
- }
+ if (c->pasta_netns_fd < 0)
+ die("Couldn't switch to pasta namespaces");
if (!c->no_netns_quit) {
char buf[PATH_MAX] = { 0 };
@@ -232,11 +228,9 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
arg.exe = "/bin/sh";
if ((size_t)snprintf(sh_arg0, sizeof(sh_arg0),
- "-%s", arg.exe) >= sizeof(sh_arg0)) {
- err("$SHELL is too long (%u bytes)",
- strlen(arg.exe));
- exit(EXIT_FAILURE);
- }
+ "-%s", arg.exe) >= sizeof(sh_arg0))
+ die("$SHELL is too long (%u bytes)", strlen(arg.exe));
+
sh_argv[0] = sh_arg0;
arg.argv = sh_argv;
}