Commit 0c19ee2

kravantokh <kravantokh@noreply.codeberg.org>
2026-03-13 18:31:06
Disabled file creation when opening files for reading.
1 parent 5e09d4b
Changed files (1)
io/file.h
@@ -71,11 +71,12 @@ status File_write( File *f, u64 *amount, const u8 *in);
 				return ERROR_INVALID_ARGUMENTS;
 			}
 
-			if( !(file_options & FILEOPTION_DISALLOW_CREATION) ) {
+			/* Reads shouldn't create files, like ever. This option only makes sense on write. */
+			if( !(file_options & FILEOPTION_DISALLOW_CREATION && (file_options & FILEOPTION_WRITE) ) ) {
 				mode |= O_CREAT;
 			}
 
-			if( file_options & FILEOPTION_NO_FOLLOW_LINKS ) {
+			if( (file_options & FILEOPTION_NO_FOLLOW_LINKS) ) {
 				mode |= O_NOFOLLOW;
 			}