summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libudev/libudev-monitor.c6
-rw-r--r--src/libudev/util.h6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 43fd8762da..ec3f6da91e 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -108,15 +108,13 @@ 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;
+ union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, };
int mount_id;
_cleanup_fclose_ FILE *f = NULL;
char line[LINE_MAX], *e;
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;
diff --git a/src/libudev/util.h b/src/libudev/util.h
index 6510237e1e..4efa4e062a 100644
--- a/src/libudev/util.h
+++ b/src/libudev/util.h
@@ -19,6 +19,7 @@
#pragma once
+#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
@@ -300,3 +301,8 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size,
int proc_cmdline(char **ret);
int getpeercred(int fd, struct ucred *ucred);
+
+union file_handle_union {
+ struct file_handle handle;
+ char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
+};