]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm: enclose invocation of unlinkat() with a (void) cast
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Apr 2015 11:21:44 +0000 (13:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Apr 2015 15:43:55 +0000 (17:43 +0200)
Let's make Coverity happy about this one.

src/udev/udevadm-info.c

index 352e024a7c65f09d7690db98f29d915157a202a9..b3d5565c48bf100ad4201ae8b5150b3b500b5ce3 100644 (file)
@@ -205,17 +205,15 @@ static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
                 if ((stats.st_mode & mask) != 0)
                         continue;
                 if (S_ISDIR(stats.st_mode)) {
-                        DIR *dir2;
+                        _cleanup_closedir_ DIR *dir2;
 
                         dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
-                        if (dir2 != NULL) {
+                        if (dir2 != NULL)
                                 cleanup_dir(dir2, mask, depth-1);
-                                closedir(dir2);
-                        }
-                        unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR);
-                } else {
-                        unlinkat(dirfd(dir), dent->d_name, 0);
-                }
+
+                        (void) unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR);
+                } else
+                        (void) unlinkat(dirfd(dir), dent->d_name, 0);
         }
 }