richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
594167
From 43622b6eed32aece624a293167a6d705c08b8d03 Mon Sep 17 00:00:00 2001
594167
From: Frantisek Sumsal <frantisek@sumsal.cz>
594167
Date: Sun, 30 Jan 2022 15:49:27 +0100
594167
Subject: [PATCH] core: check argc/argv uncoditionally
594167
594167
as `assert()` might be dropped with `-DNDEBUG`.
594167
594167
Follow-up to cf3095a and 1637e75.
594167
594167
(cherry picked from commit 61b9769bda465f4832080e2a7a8285d247121d70)
594167
594167
Related: #2017035
594167
---
594167
 src/core/main.c        | 2 +-
594167
 src/shared/main-func.h | 2 +-
594167
 2 files changed, 2 insertions(+), 2 deletions(-)
594167
594167
diff --git a/src/core/main.c b/src/core/main.c
594167
index f315a44a08..cb3131c12a 100644
594167
--- a/src/core/main.c
594167
+++ b/src/core/main.c
594167
@@ -2726,7 +2726,7 @@ int main(int argc, char *argv[]) {
594167
         Manager *m = NULL;
594167
         FDSet *fds = NULL;
594167
 
594167
-        assert(argc > 0 && !isempty(argv[0]));
594167
+        assert_se(argc > 0 && !isempty(argv[0]));
594167
 
594167
         /* SysV compatibility: redirect init → telinit */
594167
         redirect_telinit(argc, argv);
594167
diff --git a/src/shared/main-func.h b/src/shared/main-func.h
594167
index 09103bace9..81a5c1813c 100644
594167
--- a/src/shared/main-func.h
594167
+++ b/src/shared/main-func.h
594167
@@ -15,7 +15,7 @@
594167
 #define _DEFINE_MAIN_FUNCTION(intro, impl, ret)                         \
594167
         int main(int argc, char *argv[]) {                              \
594167
                 int r;                                                  \
594167
-                assert(argc > 0 && !isempty(argv[0]));                  \
594167
+                assert_se(argc > 0 && !isempty(argv[0]));               \
594167
                 save_argc_argv(argc, argv);                             \
594167
                 intro;                                                  \
594167
                 r = impl;                                               \