diff options
author | Laine Stump <laine@redhat.com> | 2023-02-15 03:24:35 -0500 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-02-16 17:32:21 +0100 |
commit | 60bd93e91f8bfb918f60f2427e16bb76301cea0d (patch) | |
tree | 48f1cb67365bc529b1fe1543c4da505596e17e1d /conf.c | |
parent | ead4a98111d4cfb4696fa7aa3501a69d7c119dec (diff) | |
download | passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar.gz passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar.bz2 passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar.lz passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar.xz passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.tar.zst passt-60bd93e91f8bfb918f60f2427e16bb76301cea0d.zip |
make conf_netns_opt() exit immediately after logging error
...and return void to simplify the caller.
Signed-off-by: Laine Stump <laine@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -464,10 +464,8 @@ out: * conf_netns_opt() - Parse --netns option * @netns: buffer of size PATH_MAX, updated with netns path * @arg: --netns argument - * - * Return: 0 on success, negative error code otherwise */ -static int conf_netns_opt(char *netns, const char *arg) +static void conf_netns_opt(char *netns, const char *arg) { int ret; @@ -479,12 +477,8 @@ static int conf_netns_opt(char *netns, const char *arg) ret = snprintf(netns, PATH_MAX, "%s", arg); } - if (ret <= 0 || ret > PATH_MAX) { - err("Network namespace name/path %s too long"); - return -E2BIG; - } - - return 0; + if (ret <= 0 || ret > PATH_MAX) + die("Network namespace name/path %s too long"); } /** @@ -1157,9 +1151,7 @@ void conf(struct ctx *c, int argc, char **argv) if (c->mode != MODE_PASTA) die("--netns is for pasta mode only"); - ret = conf_netns_opt(netns, optarg); - if (ret < 0) - usage(argv[0]); + conf_netns_opt(netns, optarg); break; case 4: if (c->mode != MODE_PASTA) |