From 20c3acfaad0b93990eafb6b994811db8c0617498 Mon Sep 17 00:00:00 2001 From: Benjamin Robin Date: Fri, 8 May 2020 13:32:11 +0200 Subject: [PATCH] tree-wide: Replace assert() by assert_se() when there is side effect --- src/core/unit.c | 2 +- src/import/import-fs.c | 4 ++-- src/test/test-sleep.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 24d7e901ba..7c8bae9a0d 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2777,7 +2777,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); } } diff --git a/src/import/import-fs.c b/src/import/import-fs.c index 5e61049ced..db55fa50d5 100644 --- a/src/import/import-fs.c +++ b/src/import/import-fs.c @@ -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; } diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index 014b1aa7a2..2e63aace02 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -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;