Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# #
#############################################################################*/
+#include <errno.h>
#include <stdio.h>
#include <string.h>
FILE* pakfire_xfopen(FILE* f, const char* mode) {
char buffer[MAX_MAGIC_LENGTH];
- if (!f)
+ if (!f) {
+ errno = EBADFD;
return NULL;
+ }
+
+ if (!mode) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ // This only works for reading files
+ if (*mode != 'r') {
+ errno = ENOTSUP;
+ return NULL;
+ }
fpos_t pos;