diff options
author | Laine Stump <laine@redhat.com> | 2023-02-15 03:24:37 -0500 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 17:32:27 +0100 |
commit | c9af6f92db9f760e0b03a75bf688439e4aeab231 (patch) | |
tree | 88807dd9f5aa5b0379d792ac1ec1fc15bf1f4eb3 /tap.c | |
parent | a1ab1ca2eedbc16139cf03df06c6012b22f1f2cb (diff) | |
download | passt-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 'tap.c')
-rw-r--r-- | tap.c | 30 |
1 files changed, 10 insertions, 20 deletions
@@ -1008,10 +1008,8 @@ static void tap_sock_unix_init(struct ctx *c) }; int i; - if (fd < 0) { - err("UNIX socket: %s", strerror(errno)); - exit(EXIT_FAILURE); - } + if (fd < 0) + die("UNIX socket: %s", strerror(errno)); /* In passt mode, we don't know the guest's MAC until it sends * us packets. Use the broadcast address so our first packets @@ -1029,18 +1027,14 @@ static void tap_sock_unix_init(struct ctx *c) snprintf(path, UNIX_PATH_MAX - 1, UNIX_SOCK_PATH, i); ex = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); - if (ex < 0) { - err("UNIX domain socket check: %s", strerror(errno)); - exit(EXIT_FAILURE); - } + if (ex < 0) + die("UNIX domain socket check: %s", strerror(errno)); ret = connect(ex, (const struct sockaddr *)&addr, sizeof(addr)); if (!ret || (errno != ENOENT && errno != ECONNREFUSED && errno != EACCES)) { - if (*c->sock_path) { - err("Socket path %s already in use", path); - exit(EXIT_FAILURE); - } + if (*c->sock_path) + die("Socket path %s already in use", path); close(ex); continue; @@ -1053,10 +1047,8 @@ static void tap_sock_unix_init(struct ctx *c) break; } - if (i == UNIX_SOCK_MAX) { - err("UNIX socket bind: %s", strerror(errno)); - exit(EXIT_FAILURE); - } + if (i == UNIX_SOCK_MAX) + die("UNIX socket bind: %s", strerror(errno)); info("UNIX domain socket bound at %s\n", addr.sun_path); @@ -1159,10 +1151,8 @@ static void tap_sock_tun_init(struct ctx *c) struct epoll_event ev = { 0 }; NS_CALL(tap_ns_tun, c); - if (tun_ns_fd == -1) { - err("Failed to open tun socket in namespace"); - exit(EXIT_FAILURE); - } + if (tun_ns_fd == -1) + die("Failed to open tun socket in namespace"); pasta_ns_conf(c); |