summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-03-27 14:48:36 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-03-27 14:48:36 -0400
commitccfc70a1ccca27a1481ae5dae11d8ea9f5fc8ef9 (patch)
tree6815ae9bb6f2c7e2befca6d9ca4bb68a669708ac
parentcef0869f62487b7a729b005f345e5ecd9a9bbfc7 (diff)
downloadbfs-ccfc70a1ccca27a1481ae5dae11d8ea9f5fc8ef9.tar.xz
dir: Explicitly align struct bfs_dir for the trailing dirent buffer
-rw-r--r--src/dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dir.c b/src/dir.c
index 83e8a66..be2c44e 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -7,6 +7,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdalign.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -105,9 +106,10 @@ enum bfs_type bfs_mode_to_type(mode_t mode) {
struct bfs_dir {
#if BFS_GETDENTS
- int fd;
+ alignas(sys_dirent) int fd;
unsigned short pos;
unsigned short size;
+ // sys_dirent buf[];
#else
DIR *dir;
struct dirent *de;