tree-wide: Replace assert() by assert_se() when there is side effect
authorBenjamin Robin <dev@benjarobin.fr>
Fri, 8 May 2020 11:32:11 +0000 (13:32 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 31 May 2020 05:05:12 +0000 (07:05 +0200)
(cherry picked from commit 20c3acfaad0b93990eafb6b994811db8c0617498)

src/core/unit.c
src/import/import-fs.c
src/test/test-sleep.c

index 97e1b0004c8955d1af02d046c78e5cd9e7020702..d3a09be2900ed756410845a3d399108444d445cf 100644 (file)
@@ -2704,7 +2704,7 @@ void unit_unwatch_pid(Unit *u, pid_t pid) {
 
                 if (m == 0) {
                         /* The array is now empty, remove the entire entry */
-                        assert(hashmap_remove(u->manager->watch_pids, PID_TO_PTR(-pid)) == array);
+                        assert_se(hashmap_remove(u->manager->watch_pids, PID_TO_PTR(-pid)) == array);
                         free(array);
                 }
         }
index 5e61049ced8fe06d6560c3dc5f4447b6de06d326..db55fa50d5d9f2cc8dffb75922c5b68b5ddecfb5 100644 (file)
@@ -220,8 +220,8 @@ static int import_fs(int argc, char *argv[], void *userdata) {
 
 finish:
         /* Put old signal handlers into place */
-        assert(sigaction(SIGINT, &old_sigint_sa, NULL) >= 0);
-        assert(sigaction(SIGTERM, &old_sigterm_sa, NULL) >= 0);
+        assert_se(sigaction(SIGINT, &old_sigint_sa, NULL) >= 0);
+        assert_se(sigaction(SIGTERM, &old_sigterm_sa, NULL) >= 0);
 
         return 0;
 }
index 014b1aa7a2f0eea88d54564cb61b9748159408c5..2e63aace0201ab696fb5ba04af384dd2f6459d2a 100644 (file)
@@ -20,7 +20,7 @@ static void test_parse_sleep_config(void) {
         _cleanup_(free_sleep_configp) SleepConfig *sleep_config = NULL;
         log_info("/* %s */", __func__);
 
-        assert(parse_sleep_config(&sleep_config) == 0);
+        assert_se(parse_sleep_config(&sleep_config) == 0);
 
         _cleanup_free_ char *sum, *sus, *him, *his, *hym, *hys;