aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-07-18 23:05:43 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-07-18 23:05:43 +0200
commit5c46d829541076e3e2adb817cf287bf8c18de724 (patch)
treee79a7d828e320409ed4a399c7ef56ca0f485cafc
parent047a55640ce4c194e5b99266b59d4175efeae058 (diff)
downloaddesktop-tools-5c46d829541076e3e2adb817cf287bf8c18de724.tar.gz
desktop-tools-5c46d829541076e3e2adb817cf287bf8c18de724.tar.xz
desktop-tools-5c46d829541076e3e2adb817cf287bf8c18de724.zip
priod: make sure it compiles on older kernels
-rw-r--r--priod.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/priod.c b/priod.c
index 0996ee2..6569bb5 100644
--- a/priod.c
+++ b/priod.c
@@ -368,7 +368,7 @@ on_event (const struct pollfd *pfd, struct app_context *ctx)
(struct sockaddr *) &addr, &addr_len);
if (len == 0)
exit_fatal ("socket closed");
- if (len < 0 && errno == EAGAIN)
+ if (len < 0 && (errno == EAGAIN || errno == ENOBUFS))
return;
if (len < 0)
exit_fatal ("recvfrom: %s", strerror (errno));
@@ -476,9 +476,12 @@ setup_exec_filter (int fd)
struct sock_fprog fprog = { .filter = filter, .len = N_ELEMENTS (filter) };
const int yes = 1;
- if (setsockopt (fd, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof fprog) < 0
- || setsockopt (fd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &yes, sizeof yes) < 0)
+ if (setsockopt (fd, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof fprog) < 0)
print_error ("setsockopt: %s", strerror (errno));
+#if defined SOL_NETLINK && defined NETLINK_NO_ENOBUFS
+ if (setsockopt (fd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &yes, sizeof yes) < 0)
+ print_error ("setsockopt: %s", strerror (errno));
+#endif
}
int