summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-monitor.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-15 19:21:37 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-15 19:40:51 +0200
commit6d5e65f6454212cd400d0ebda34978a9f20cc26a (patch)
tree844cd4d517956481a0963598edf586ae454524a0 /src/libudev/libudev-monitor.c
parent8e8132c6b849a0aa34dbe8d97027beb50f71f1e3 (diff)
downloadsystemd-6d5e65f6454212cd400d0ebda34978a9f20cc26a.tar.gz
tree-wide: add a single version of "static const int one = 1"
All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
Diffstat (limited to 'src/libudev/libudev-monitor.c')
-rw-r--r--src/libudev/libudev-monitor.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index ea44308351..50c3925058 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -337,7 +337,6 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct
* Returns: 0 on success, otherwise a negative error value.
*/
_public_ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) {
- const int on = 1;
int r;
assert_return(udev_monitor, -EINVAL);
@@ -358,7 +357,7 @@ _public_ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) {
return log_debug_errno(r, "Failed to set address: %m");
/* enable receiving of sender credentials */
- if (setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0)
+ if (setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &const_int_one, sizeof(const_int_one)) < 0)
return log_debug_errno(errno, "Failed to set socket option SO_PASSCRED: %m");
return 0;