tree-wide: use new RET_NERRNO() helper at various places

This commit is contained in:
Lennart Poettering
2021-11-16 08:04:09 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent ef470ffa23
commit 7c248223eb
51 changed files with 151 additions and 469 deletions
+3 -12
View File
@@ -152,10 +152,7 @@ int fd_nonblock(int fd, bool nonblock) {
if (nflags == flags)
return 0;
if (fcntl(fd, F_SETFL, nflags) < 0)
return -errno;
return 0;
return RET_NERRNO(fcntl(fd, F_SETFL, nflags));
}
int fd_cloexec(int fd, bool cloexec) {
@@ -171,10 +168,7 @@ int fd_cloexec(int fd, bool cloexec) {
if (nflags == flags)
return 0;
if (fcntl(fd, F_SETFD, nflags) < 0)
return -errno;
return 0;
return RET_NERRNO(fcntl(fd, F_SETFD, nflags));
}
_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {
@@ -802,8 +796,5 @@ int btrfs_defrag_fd(int fd) {
if (r < 0)
return r;
if (ioctl(fd, BTRFS_IOC_DEFRAG, NULL) < 0)
return -errno;
return 0;
return RET_NERRNO(ioctl(fd, BTRFS_IOC_DEFRAG, NULL));
}