Blame SOURCES/0492-introduce-setsockopt_int-helper.patch
|
|
21255d |
From 8cff80d7fc28ca04bd6c8e2257b46d96bea338ce Mon Sep 17 00:00:00 2001
|
|
|
21255d |
From: Lennart Poettering <lennart@poettering.net>
|
|
|
21255d |
Date: Thu, 18 Oct 2018 19:48:18 +0200
|
|
|
21255d |
Subject: [PATCH] introduce setsockopt_int() helper
|
|
|
21255d |
|
|
|
21255d |
As suggested by @heftig:
|
|
|
21255d |
|
|
|
21255d |
https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
|
|
|
21255d |
(cherry picked from commit 2ff48e981e6cd1ccbfae49943274d9c8319a5e5d)
|
|
|
21255d |
|
|
|
21255d |
Related: #1887181
|
|
|
21255d |
---
|
|
|
21255d |
src/basic/socket-util.h | 7 +++++++
|
|
|
21255d |
1 file changed, 7 insertions(+)
|
|
|
21255d |
|
|
|
21255d |
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
|
|
|
21255d |
index 82781a0de1..616f2e0d05 100644
|
|
|
21255d |
--- a/src/basic/socket-util.h
|
|
|
21255d |
+++ b/src/basic/socket-util.h
|
|
|
21255d |
@@ -183,3 +183,10 @@ struct cmsghdr* cmsg_find(struct msghdr *mh, int level, int type, socklen_t leng
|
|
|
21255d |
})
|
|
|
21255d |
|
|
|
21255d |
int socket_ioctl_fd(void);
|
|
|
21255d |
+
|
|
|
21255d |
+static inline int setsockopt_int(int fd, int level, int optname, int value) {
|
|
|
21255d |
+ if (setsockopt(fd, level, optname, &value, sizeof(value)) < 0)
|
|
|
21255d |
+ return -errno;
|
|
|
21255d |
+
|
|
|
21255d |
+ return 0;
|
|
|
21255d |
+}
|