dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
8d419f
From efe174ec51b9242101868e83f12cc1186fe1b71b Mon Sep 17 00:00:00 2001
8d419f
From: Yu Watanabe <watanabe.yu+github@gmail.com>
8d419f
Date: Sun, 30 Jan 2022 17:54:55 +0900
8d419f
Subject: [PATCH] core: check if argc > 0 and argv[0] is set
8d419f
8d419f
Follow-up for 1637e757070a61b12b26a2a4ef547330562dc77f.
8d419f
8d419f
(cherry picked from commit cf3095ac2bbdba3db0d8f7fa7afcee8b8c136201)
8d419f
8d419f
Related: #2017035
8d419f
---
8d419f
 src/core/main.c | 2 ++
8d419f
 1 file changed, 2 insertions(+)
8d419f
8d419f
diff --git a/src/core/main.c b/src/core/main.c
8d419f
index 7ea848ebeb..f315a44a08 100644
8d419f
--- a/src/core/main.c
8d419f
+++ b/src/core/main.c
8d419f
@@ -2726,6 +2726,8 @@ int main(int argc, char *argv[]) {
8d419f
         Manager *m = NULL;
8d419f
         FDSet *fds = NULL;
8d419f
 
8d419f
+        assert(argc > 0 && !isempty(argv[0]));
8d419f
+
8d419f
         /* SysV compatibility: redirect init → telinit */
8d419f
         redirect_telinit(argc, argv);
8d419f