#include "dive.h"
#include "file.h"
+/* Crazy windows sh*t */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
static int readfile(const char *filename, struct memblock *mem)
{
- int ret, fd = open(filename, O_RDONLY);
+ int ret, fd;
struct stat st;
char *buf;
mem->buffer = NULL;
mem->size = 0;
- fd = open(filename, O_RDONLY);
+ fd = open(filename, O_RDONLY | O_BINARY);
if (fd < 0)
return fd;
ret = fstat(fd, &st);