aboutgitcodebugslistschat
path: root/passt.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-02-17 01:41:28 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-02-21 13:41:13 +0100
commitce4e7b4d5ddb213f45164015ef5479943fec2f8e (patch)
treef7256189813c4c699de12c72b3ac680bcf3cdc97 /passt.c
parentfb70301b1358a7a65e0f6089ee9349330db2465a (diff)
downloadpasst-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar.gz
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar.bz2
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar.lz
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar.xz
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.tar.zst
passt-ce4e7b4d5ddb213f45164015ef5479943fec2f8e.zip
Makefile, conf, passt: Drop passt4netns references, explicit argc check
Nobody currently calls this as passt4netns, that was the name I used before 'pasta', drop any reference before it's too late. While at it, explicitly check that argc is bigger than or equal to one, just as a defensive measure: argv[0] being NULL is not an issue anyway. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r--passt.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/passt.c b/passt.c
index b5086d8..67ad1c7 100644
--- a/passt.c
+++ b/passt.c
@@ -322,16 +322,21 @@ int main(int argc, char **argv)
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGQUIT, &sa, NULL);
- if (strstr(argv[0], "pasta") || strstr(argv[0], "passt4netns")) {
+ if (argc < 1)
+ exit(EXIT_FAILURE);
+
+ if (strstr(argv[0], "pasta")) {
sa.sa_handler = pasta_child_handler;
sigaction(SIGCHLD, &sa, NULL);
signal(SIGPIPE, SIG_IGN);
c.mode = MODE_PASTA;
log_name = "pasta";
- } else {
+ } else if (strstr(argv[0], "passt")) {
c.mode = MODE_PASST;
log_name = "passt";
+ } else {
+ exit(EXIT_FAILURE);
}
if (madvise(pkt_buf, TAP_BUF_BYTES, MADV_HUGEPAGE))