Browse Source

Merge pull request #4059 from laytan/loop-write-entire-file

loop write_entire_file to write more than MAX_RW
Laytan 1 year ago
parent
commit
b71e0c2e36
1 changed files with 3 additions and 1 deletions
  1. 3 1
      core/os/os.odin

+ 3 - 1
core/os/os.odin

@@ -185,7 +185,9 @@ write_entire_file_or_err :: proc(name: string, data: []byte, truncate := true) -
 	fd := open(name, flags, mode) or_return
 	defer close(fd)
 
-	_ = write(fd, data) or_return
+	for n := 0; n < len(data); {
+		n += write(fd, data[n:]) or_return
+	}
 	return nil
 }