diff options
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r-- | src/test/test-util.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index 875aeab3d5..dd7768d36c 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -397,6 +397,7 @@ static void test_u64log2(void) { } static void test_get_process_comm(void) { + struct stat st; _cleanup_free_ char *a = NULL, *c = NULL, *d = NULL, *f = NULL, *i = NULL; unsigned long long b; pid_t e; @@ -405,8 +406,12 @@ static void test_get_process_comm(void) { dev_t h; int r; - assert_se(get_process_comm(1, &a) >= 0); - log_info("pid1 comm: '%s'", a); + if (stat("/proc/1/comm", &st) == 0) { + assert_se(get_process_comm(1, &a) >= 0); + log_info("pid1 comm: '%s'", a); + } else { + log_warning("/proc/1/comm does not exist."); + } assert_se(get_starttime_of_pid(1, &b) >= 0); log_info("pid1 starttime: '%llu'", b); |