chiark / gitweb /
util: make sure all our name_to_handle_at() code makes use of file_handle_union
[elogind.git] / src / libudev / libudev-monitor.c
index 3f7436b0947419b9cb25a9ad0688a6e77fdebee8..c05cb3e511bd840146ed67e4fcc4e65f1defc8be 100644 (file)
@@ -108,19 +108,20 @@ 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) {
-        struct file_handle *h;
-        int mount_id;
+
+        union file_handle_union h = {
+                .handle.handle_bytes = MAX_HANDLE_SZ
+        };
+
         _cleanup_fclose_ FILE *f = NULL;
         char line[LINE_MAX], *e;
+        int mount_id;
         int r;
 
-        h = alloca(MAX_HANDLE_SZ);
-        h->handle_bytes = MAX_HANDLE_SZ;
-        r = name_to_handle_at(AT_FDCWD, "/dev", h, &mount_id, 0);
+        r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0);
         if (r < 0)
                 return false;
 
-
         f = fopen("/proc/self/mountinfo", "re");
         if (!f)
                 return false;