diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-12-20 10:02:10 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 10:02:10 +0900 |
commit | 57e7af551edafa8ad840a26c28184bc6339e09ad (patch) | |
tree | 083f7070d545fac20aa2375426d9d0c3ac9fe1ac /src/boot | |
parent | 8d8d4b092aa94803c01638a2a7343d12f2b2776c (diff) | |
parent | 351293b3bbea3623aa9f643272ca5936951e34da (diff) | |
download | systemd-57e7af551edafa8ad840a26c28184bc6339e09ad.tar.gz |
Merge pull request #25786 from keszybz/ebadf
Use -EBADF for fd initialization
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/bless-boot.c | 4 | ||||
-rw-r--r-- | src/boot/bootctl-install.c | 4 | ||||
-rw-r--r-- | src/boot/bootctl-random-seed.c | 2 | ||||
-rw-r--r-- | src/boot/bootctl-status.c | 2 | ||||
-rw-r--r-- | src/boot/measure.c | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c index b2dd60f8ad..59f02b761a 100644 --- a/src/boot/bless-boot.c +++ b/src/boot/bless-boot.c @@ -360,7 +360,7 @@ static int verb_status(int argc, char *argv[], void *userdata) { left, done); STRV_FOREACH(p, arg_path) { - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; fd = open(*p, O_DIRECTORY|O_CLOEXEC|O_RDONLY); if (fd < 0) { @@ -439,7 +439,7 @@ static int verb_set(int argc, char *argv[], void *userdata) { } STRV_FOREACH(p, arg_path) { - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; fd = open(*p, O_DIRECTORY|O_CLOEXEC|O_RDONLY); if (fd < 0) diff --git a/src/boot/bootctl-install.c b/src/boot/bootctl-install.c index c14bdb69f8..d6c2feaeaf 100644 --- a/src/boot/bootctl-install.c +++ b/src/boot/bootctl-install.c @@ -299,7 +299,7 @@ static int version_check(int fd_from, const char *from, int fd_to, const char *t } static int copy_file_with_version_check(const char *from, const char *to, bool force) { - _cleanup_close_ int fd_from = -1, fd_to = -1; + _cleanup_close_ int fd_from = -EBADF, fd_to = -EBADF; _cleanup_free_ char *t = NULL; int r; @@ -899,7 +899,7 @@ static int remove_boot_efi(const char *esp_path) { return log_error_errno(r, "Failed to open directory \"%s/EFI/BOOT\": %m", esp_path); FOREACH_DIRENT(de, d, break) { - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; _cleanup_free_ char *v = NULL; if (!endswith_no_case(de->d_name, ".efi")) diff --git a/src/boot/bootctl-random-seed.c b/src/boot/bootctl-random-seed.c index 0b3ff74eaa..7d6e863728 100644 --- a/src/boot/bootctl-random-seed.c +++ b/src/boot/bootctl-random-seed.c @@ -19,7 +19,7 @@ int install_random_seed(const char *esp) { _cleanup_(unlink_and_freep) char *tmp = NULL; uint8_t buffer[RANDOM_EFI_SEED_SIZE]; _cleanup_free_ char *path = NULL; - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; size_t token_size; ssize_t n; int r; diff --git a/src/boot/bootctl-status.c b/src/boot/bootctl-status.c index 44f38004f5..a0fee7d3c7 100644 --- a/src/boot/bootctl-status.c +++ b/src/boot/bootctl-status.c @@ -205,7 +205,7 @@ static int enumerate_binaries( FOREACH_DIRENT(de, d, break) { _cleanup_free_ char *v = NULL; - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; if (!endswith_no_case(de->d_name, ".efi")) continue; diff --git a/src/boot/measure.c b/src/boot/measure.c index 4ee5b1de3b..a153455904 100644 --- a/src/boot/measure.c +++ b/src/boot/measure.c @@ -427,7 +427,7 @@ static int measure_kernel(PcrState *pcr_states, size_t n) { for (UnifiedSection c = 0; c < _UNIFIED_SECTION_MAX; c++) { _cleanup_(evp_md_ctx_free_all) EVP_MD_CTX **mdctx = NULL; - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; uint64_t m = 0; if (!arg_sections[c]) |