Merge pull request #15868 from keszybz/fix-failed-to-fix-up-pid1-environment

Fix bad errno checks
This commit is contained in:
Lennart Poettering 2020-05-20 21:07:47 +02:00 committed by GitHub
commit 0c789b6b81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -331,7 +331,7 @@ int systemd_efi_options_variable(char **line) {
* does, let's return a recognizable error (EPERM), and if not ENODATA. */ * does, let's return a recognizable error (EPERM), and if not ENODATA. */
if (access(k, F_OK) < 0) if (access(k, F_OK) < 0)
return errno == -ENOENT ? -ENODATA : -errno; return errno == ENOENT ? -ENODATA : -errno;
return -EPERM; return -EPERM;
} }

View file

@ -419,7 +419,7 @@ int read_full_virtual_file(const char *filename, char **ret_contents, size_t *re
break; break;
} }
if (errno != -EINTR) if (errno != EINTR)
return -errno; return -errno;
} }

View file

@ -517,7 +517,7 @@ static int copy_file_with_version_check(const char *from, const char *to, bool f
if (!force) { if (!force) {
fd_to = open(to, O_RDONLY|O_CLOEXEC|O_NOCTTY); fd_to = open(to, O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd_to < 0) { if (fd_to < 0) {
if (errno != -ENOENT) if (errno != ENOENT)
return log_error_errno(errno, "Failed to open \"%s\" for reading: %m", to); return log_error_errno(errno, "Failed to open \"%s\" for reading: %m", to);
} else { } else {
r = version_check(fd_from, from, fd_to, to); r = version_check(fd_from, from, fd_to, to);

View file

@ -1051,7 +1051,7 @@ static int home_remove(UserRecord *h) {
assert(ip); assert(ip);
if (stat(ip, &st) < 0) { if (stat(ip, &st) < 0) {
if (errno != -ENOENT) if (errno != ENOENT)
return log_error_errno(errno, "Failed to stat() %s: %m", ip); return log_error_errno(errno, "Failed to stat() %s: %m", ip);
} else { } else {