diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-04-04 10:17:16 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-04-12 11:44:52 +0200 |
commit | fdeea3f4f1c0f78f1014582135d047265098fb82 (patch) | |
tree | d0d0f329f5b7dedd3c781cf64f0f468105e3befb /src/cryptsetup/cryptsetup-generator.c | |
parent | 03abeb0baf7fe97c98a98d745b75c7d33e2f632e (diff) | |
download | systemd-fdeea3f4f1c0f78f1014582135d047265098fb82.tar.gz |
Add fopen_unlocked() wrapper
Diffstat (limited to 'src/cryptsetup/cryptsetup-generator.c')
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index e9b21689c7..fbb443c6e2 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -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; |