]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Simplify a couple of conditions
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 16:07:50 +0000 (18:07 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Apr 2024 16:08:22 +0000 (18:08 +0200)
src/ssh-generator/ssh-generator.c
src/test/test-dirent-util.c

index 5e037835435501060e8292b01b11ffa984e64800..3b9987b581f65210f73bf5e7ef556a1c0da34cf3 100644 (file)
@@ -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");
index be0496904f8a999c8fae133be5ae4c9505efd957..8192a53e6fe0779f1a9e82c4aadd3b91b564e1fc 100644 (file)
@@ -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);
         }