summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-04-19 13:22:35 -0400
committerDave Reisner <dreisner@archlinux.org>2014-04-21 09:52:08 -0400
commit370c860f748d149097710dc7952a64f627db9de7 (patch)
tree8f5238269d4c3e8622dec4d7d97f1afd775e230e /src/shared/util.h
parentdbb9401dba0bd5157d021e695a47bf52b2d74a2d (diff)
implement a union to pad out file_handle
Cases where name_to_handle_at is used allocated the full struct to be MAX_HANDLE_SZ, and assigned this size to handle_bytes. This is wrong since handle_bytes should describe the length of the flexible array member and not the whole struct. Define a union type which includes sufficient padding to allow assignment of MAX_HANDLE_SZ to be correct.
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 900f1cf54d..891848a1d8 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -22,6 +22,7 @@
***/
#include <alloca.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
@@ -914,3 +915,8 @@ uint64_t physical_memory(void);
char* mount_test_option(const char *haystack, const char *needle);
void hexdump(FILE *f, const void *p, size_t s);
+
+union file_handle_union {
+ struct file_handle handle;
+ char padding[sizeof(struct file_handle) + MAX_HANDLE_SZ];
+};