fix file access
authorLaurent Mazet <mazet@softndesign.org>
Thu, 20 Jul 2023 09:37:42 +0000 (11:37 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 20 Jul 2023 09:37:42 +0000 (11:37 +0200)
file.c
http.c

diff --git a/file.c b/file.c
index fdcd1ee711f5eb1a194004fcba6a9eb6bbbb98c3..786a895c1b8d9c6b896c3aa921b908079f8847d9 100644 (file)
--- a/file.c
+++ b/file.c
@@ -32,7 +32,7 @@ int readfile (char **buffer, char *filename)
 
     VERBOSE (DEBUG, PRINT ("Reading %d bytes\n", size));
     *buffer = calloc (size + 1, 1);
-    int len = fread (*buffer, size, 1, fd);
+    int len = fread (*buffer, 1, size, fd);
     if (len != size) {
         VERBOSE (WARNING, PRINT ("Can't read full file (%s)\n", filename));
     }
diff --git a/http.c b/http.c
index 2f37611e656f5f4aecebf7553faa164aa5a65d69..22b5cbcbbf901c169ca439bbcd45b97f837d1c8c 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <unistd.h>
 
 #include "debug.h"
 #include "file.h"