From 2695c5c44e028d1bc07404baf3357e5a6017fc57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 7 Jan 2015 10:28:04 -0500 Subject: [PATCH] Add initialization helper for file_handle_union --- src/libudev/libudev-monitor.c | 5 +---- src/shared/path-util.c | 5 +---- src/shared/util.h | 1 + src/tmpfiles/tmpfiles.c | 5 +---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index 0d361426f..da2b63473 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 ee87c7493..00d2d4499 100644 --- a/src/shared/path-util.c +++ b/src/shared/path-util.c @@ -454,10 +454,7 @@ char* path_join(const char *root, const char *path, const char *rest) { 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 84453713c..5818fee82 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -993,6 +993,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 update_reboot_param_file(const char *param); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index ac9a07251..332ddcea7 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -230,10 +230,7 @@ static bool unix_socket_alive(const char *fn) { static int dir_is_mount_point(DIR *d, const char *subdir) { - union file_handle_union h = { - .handle.handle_bytes = MAX_HANDLE_SZ - }; - + union file_handle_union h = FILE_HANDLE_INIT; int mount_id_parent, mount_id; int r_p, r; -- 2.30.2