Commit: 8bec6828f49cd283ce9f341af87903d4adba4c81
Parent: 3498e1e96d3e2aa3f47342602a8881960dfad15f
Author: Randy Palamar
Date: Wed, 3 Apr 2024 22:09:43 -0600
create output file when it doesn't exist
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/posix.c b/posix.c
@@ -2,7 +2,7 @@
#include <unistd.h>
#define OS_READ O_RDONLY
-#define OS_WRITE O_WRONLY
+#define OS_WRITE (O_WRONLY | O_CREAT | O_TRUNC)
#define OS_RW O_RDWR
#define OS_SEEK_CUR SEEK_CUR
#define OS_SEEK_END SEEK_END
@@ -14,7 +14,7 @@ static os_file
os_open(s8 path, int flags)
{
os_file f;
- f = open((char *)path.data, flags);
+ f = open((char *)path.data, flags, 0600);
if (f == -1)
die("rip can't open output file: %s\n", path.data);
return f;