os: fix compilation with -cc gcc -prod of programs using os.cp

pull/5250/head
Delyan Angelov 2020-06-06 22:05:23 +03:00
parent e534f8507b
commit 16bf300934
1 changed files with 1 additions and 1 deletions

View File

@ -171,7 +171,7 @@ pub fn cp(old, new string) ?bool {
if fp_from < 0 { // Check if file opened
return error_with_code('cp: failed to open $old', int(fp_from))
}
fp_to := C.open(new.str, C.O_WRONLY | C.O_CREAT | C.O_TRUNC)
fp_to := C.open(new.str, C.O_WRONLY | C.O_CREAT | C.O_TRUNC, C.S_IWUSR | C.S_IRUSR)
if fp_to < 0 { // Check if file opened (permissions problems ...)
C.close(fp_from)
return error_with_code('cp: failed to write to $new', int(fp_to))