From: Frantisek Sumsal Date: Tue, 2 Apr 2024 16:07:50 +0000 (+0200) Subject: Simplify a couple of conditions X-Git-Tag: v256-rc1~337^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=516bb9c0be58e78fdd277a76ac026d2336189f44;p=thirdparty%2Fsystemd.git Simplify a couple of conditions --- diff --git a/src/ssh-generator/ssh-generator.c b/src/ssh-generator/ssh-generator.c index 5e037835435..3b9987b581f 100644 --- a/src/ssh-generator/ssh-generator.c +++ b/src/ssh-generator/ssh-generator.c @@ -401,10 +401,8 @@ static int parse_credentials(void) { int r; r = read_credential_with_decryption("ssh.listen", (void*) &b, &sz); - if (r < 0) + if (r <= 0) return r; - if (r == 0) - return 0; _cleanup_fclose_ FILE *f = NULL; f = fmemopen_unlocked(b, sz, "r"); diff --git a/src/test/test-dirent-util.c b/src/test/test-dirent-util.c index be0496904f8..8192a53e6fe 100644 --- a/src/test/test-dirent-util.c +++ b/src/test/test-dirent-util.c @@ -68,7 +68,7 @@ TEST (test_dirent_is_file) { } dir = opendir(t); - if (dir == NULL) { + if (!dir) { log_error_errno(errno, "Failed to open directory '%s': %m", t); exit(EXIT_FAILURE); } @@ -144,7 +144,7 @@ TEST (test_dirent_is_file_with_suffix) { } dir = opendir(t); - if (dir == NULL) { + if (!dir) { log_error_errno(errno, "Failed to open directory '%s': %m", t); exit(EXIT_FAILURE); }