]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/cryptsetup/cryptsetup-generator.c
Add fopen_unlocked() wrapper
[thirdparty/systemd.git] / src / cryptsetup / cryptsetup-generator.c
index e9b21689c725910b90d7704411ea203d50ed4f59..fbb443c6e2691abf32ece775243c1a44c119bffb 100644 (file)
@@ -2,7 +2,6 @@
 
 #include <errno.h>
 #include <fcntl.h>
-#include <stdio_ext.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -479,15 +478,13 @@ static int add_crypttab_devices(void) {
         if (!arg_read_crypttab)
                 return 0;
 
-        f = fopen("/etc/crypttab", "re");
-        if (!f) {
+        r = fopen_unlocked("/etc/crypttab", "re", &f);
+        if (r < 0) {
                 if (errno != ENOENT)
                         log_error_errno(errno, "Failed to open /etc/crypttab: %m");
                 return 0;
         }
 
-        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
-
         if (fstat(fileno(f), &st) < 0) {
                 log_error_errno(errno, "Failed to stat /etc/crypttab: %m");
                 return 0;