summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-25 16:40:20 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-01-25 16:40:20 -0500
commit6d90157e448a4938aad0bd208c5f192f14b3ef8d (patch)
tree698b0a9f2b491b7d97ae212aa5a311636522ea4f
parent0e18836796aaa697522a4dd5d8b89ac88aa9e87e (diff)
Add initialization helper for file_handle_union
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r--src/libudev/libudev-monitor.c5
-rw-r--r--src/shared/path-util.c5
-rw-r--r--src/shared/util.h1
3 files changed, 3 insertions, 8 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index c2aa341101..0a02ef153a 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -109,10 +109,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
/* we consider udev running when /dev is on devtmpfs */
static bool udev_has_devtmpfs(struct udev *udev) {
- union file_handle_union h = {
- .handle.handle_bytes = MAX_HANDLE_SZ
- };
-
+ union file_handle_union h = FILE_HANDLE_INIT;
_cleanup_fclose_ FILE *f = NULL;
char line[LINE_MAX], *e;
int mount_id;
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index b1f997aef3..152fef9b24 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -315,10 +315,7 @@ bool path_equal(const char *a, const char *b) {
int path_is_mount_point(const char *t, bool allow_symlink) {
- union file_handle_union h = {
- .handle.handle_bytes = MAX_HANDLE_SZ
- };
-
+ union file_handle_union h = FILE_HANDLE_INIT;
int mount_id = -1, mount_id_parent = -1;
_cleanup_free_ char *parent = NULL;
struct stat a, b;
diff --git a/src/shared/util.h b/src/shared/util.h
index 3fceb18841..8b7d37d73c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -461,6 +461,7 @@ union file_handle_union {
struct file_handle handle;
char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
};
+#define FILE_HANDLE_INIT { .handle.handle_bytes = MAX_HANDLE_SZ }
int tempfn_xxxxxx(const char *p, char **ret);