tree-wide: introduce setsockopt_int() helper and make use of it everywhere

As suggested by @heftig:

https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
This commit is contained in:
Lennart Poettering
2018-10-18 19:50:29 +02:00
parent 0fef958361
commit 2ff48e981e
22 changed files with 195 additions and 169 deletions
+7
View File
@@ -190,3 +190,10 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng
int socket_ioctl_fd(void);
int sockaddr_un_set_path(struct sockaddr_un *ret, const char *path);
static inline int setsockopt_int(int fd, int level, int optname, int value) {
if (setsockopt(fd, level, optname, &value, sizeof(value)) < 0)
return -errno;
return 0;
}