From ce4e7b4d5ddb213f45164015ef5479943fec2f8e Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 17 Feb 2022 01:41:28 +0100 Subject: 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 --- passt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'passt.c') 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)) -- cgit v1.2.3