From: Yu Watanabe Date: Fri, 21 Jul 2023 02:07:01 +0000 (+0900) Subject: chase: add two more assertions X-Git-Tag: v255-rc1~875^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c13bdf34291dd2444439a4e30ad35a29d22a5d8;p=thirdparty%2Fsystemd.git chase: add two more assertions When 'need_absolute' is true, 'done' should always contain "/" at the beginning, and thus should not be NULL. --- diff --git a/src/basic/chase.c b/src/basic/chase.c index e66070b5d11..4d883e18d8e 100644 --- a/src/basic/chase.c +++ b/src/basic/chase.c @@ -449,6 +449,7 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int } if (!done) { + assert(!need_absolute || FLAGS_SET(flags, CHASE_EXTRACT_FILENAME)); done = strdup(append_trail_slash ? "./" : "."); if (!done) return -ENOMEM; @@ -475,6 +476,7 @@ chased_one: const char *e; if (!done) { + assert(!need_absolute); done = strdup(append_trail_slash ? "./" : "."); if (!done) return -ENOMEM;