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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user