summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2017-09-29 09:58:22 +0200
committerSven Eden <yamakuzure@gmx.net>2017-09-29 09:58:22 +0200
commit47a7397766e88d24f3aad16d9ca2b77233f4ebca (patch)
tree70d7b619dd8e8853dfc438de2e80051867625ea7 /src
parenta4488a7509a96d8b9f0d7793517a217c70ac0361 (diff)
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
The included cocci was used to generate the changes. Thanks to @flo-wer for pointing this case out.
Diffstat (limited to 'src')
-rw-r--r--src/basic/rm-rf.c2
-rw-r--r--src/basic/socket-util.c10
-rw-r--r--src/login/logind-user.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/basic/rm-rf.c b/src/basic/rm-rf.c
index 156366c7d..fea9242be 100644
--- a/src/basic/rm-rf.c
+++ b/src/basic/rm-rf.c
@@ -206,7 +206,7 @@ int rm_rf(const char *path, RemoveFlags flags) {
fd = open(path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME);
if (fd < 0) {
- if (errno != ENOTDIR && errno != ELOOP)
+ if (!IN_SET(errno, ENOTDIR, ELOOP))
return -errno;
if (!(flags & REMOVE_PHYSICAL)) {
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index c32b8d3e1..fec5ee12e 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -268,7 +268,7 @@ int socket_address_verify(const SocketAddress *a) {
if (a->sockaddr.in.sin_port == 0)
return -EINVAL;
- if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM)
+ if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM))
return -EINVAL;
return 0;
@@ -280,7 +280,7 @@ int socket_address_verify(const SocketAddress *a) {
if (a->sockaddr.in6.sin6_port == 0)
return -EINVAL;
- if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM)
+ if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM))
return -EINVAL;
return 0;
@@ -304,7 +304,7 @@ int socket_address_verify(const SocketAddress *a) {
}
}
- if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM && a->type != SOCK_SEQPACKET)
+ if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET))
return -EINVAL;
return 0;
@@ -314,7 +314,7 @@ int socket_address_verify(const SocketAddress *a) {
if (a->size != sizeof(struct sockaddr_nl))
return -EINVAL;
- if (a->type != SOCK_RAW && a->type != SOCK_DGRAM)
+ if (!IN_SET(a->type, SOCK_RAW, SOCK_DGRAM))
return -EINVAL;
return 0;
@@ -323,7 +323,7 @@ int socket_address_verify(const SocketAddress *a) {
if (a->size != sizeof(struct sockaddr_vm))
return -EINVAL;
- if (a->type != SOCK_STREAM && a->type != SOCK_DGRAM)
+ if (!IN_SET(a->type, SOCK_STREAM, SOCK_DGRAM))
return -EINVAL;
return 0;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index cd460d365..485be84f6 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -363,7 +363,7 @@ static int user_mkdir_runtime_path(User *u) {
r = mount("tmpfs", u->runtime_path, "tmpfs", MS_NODEV|MS_NOSUID, t);
if (r < 0) {
- if (errno != EPERM && errno != EACCES) {
+ if (!IN_SET(errno, EPERM, EACCES)) {
r = log_error_errno(errno, "Failed to mount per-user tmpfs directory %s: %m", u->runtime_path);
goto fail;
}