summaryrefslogtreecommitdiff
path: root/src/util/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/map.c')
-rw-r--r--src/util/map.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util/map.c b/src/util/map.c
index 27e1c04..6a1faf1 100644
--- a/src/util/map.c
+++ b/src/util/map.c
@@ -9,7 +9,9 @@
#include "map.h"
-struct map *open_map(const char *fname) {
+struct map *open_map(const char *fname, bool *isdir) {
+ if (isdir != NULL) *isdir = false;
+
int fd = open(fname, O_RDONLY);
struct stat sb;
@@ -21,6 +23,7 @@ struct map *open_map(const char *fname) {
char *addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED) {
//fprintf(stderr, "Kon bestand niet projecteren in geheugen\n");
+ if (isdir != NULL) *isdir = S_ISDIR(sb.st_mode);
return NULL;
}