shithub: scc

Download patch

ref: 65c444328c354a3620bab5b37ceb157e6fad8f17
parent: b4cc34ebf056ddefd94a30f954950439463e67a9
author: Quentin Rameau <[email protected]>
date: Fri May 8 06:34:06 EDT 2020

libc: Fix fopen default file mode

The Linux syscall takes a third argument for file mode opening.

--- a/src/libc/stdio/_fpopen.c
+++ b/src/libc/stdio/_fpopen.c
@@ -53,7 +53,7 @@
 		return NULL;
 	}
 
-	if ((fd = _open(fname, flags)) < 0)
+	if ((fd = _open(fname, flags, 0666)) < 0)
 		return NULL;
 
 	fp->buf = NULL;
--- a/src/libc/syscall.h
+++ b/src/libc/syscall.h
@@ -1,5 +1,5 @@
 extern void *_brk(void *addr);
-extern int _open(const char *path, int flags);
+extern int _open(const char *path, int flags, int mode);
 extern int _close(int fd);
 extern int _read(int fd, void *buf, size_t n);
 extern int _write(int fd, void *buf, size_t n);