chiark / gitweb /
Add initialization helper for file_handle_union
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Jan 2015 15:28:04 +0000 (10:28 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 19 Jan 2015 00:06:48 +0000 (19:06 -0500)
src/libudev/libudev-monitor.c
src/shared/path-util.c
src/shared/util.h
src/tmpfiles/tmpfiles.c

index 0d361426f7c23c7354cbc9e544ed4a6ff5e54e67..da2b63473f3aebe5a83b46202eea3a13077e34c1 100644 (file)
@@ -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;
index ee87c7493defead6eacea8ee32ad68c4ed0eee38..00d2d44993d3711adfc2b244e994360d1f2a8912 100644 (file)
@@ -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;
index 84453713caebd2f164a498aa12a5f251eb1ab6d0..5818fee82e52f48be4bdd9c1fdea8c0ee5f169a9 100644 (file)
@@ -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);
 
index ac9a0725110bd1cc9138098fe01dd7f8f8a30b48..332ddcea766c7a3b01ef4d178841c8d451c05478 100644 (file)
@@ -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;