summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2020-05-13 09:45:00 +0200
committerPeter Bex <peter@more-magic.net>2020-05-17 17:25:14 +0200
commit3fd5747e5115496b670905f082a875e4d7e5bf04 (patch)
tree2e90b37a30476146e357ecf536f4dc87c3b9650e
parent594199c4f9d8f86d75a022f01a84610087fb518a (diff)
downloadscsh-process-3fd5747e5115496b670905f082a875e4d7e5bf04.tar.gz
Use 0666 as default file-open mode
Signed-off-by: Peter Bex <peter@more-magic.net>
-rw-r--r--scsh-process.scm27
1 files changed, 21 insertions, 6 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index a6d4bdf..b106bbf 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -11,7 +11,7 @@
;; WARNING: Don't mix with threading unless you're using
;; Chicken 4.8.1 rev 47b5be71 or later.
;;
-;;; Copyright (c) 2012-2018, Peter Bex
+;;; Copyright (c) 2012-2020, Peter Bex
;; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,8 @@
(chicken-5 (import (chicken base) (chicken condition) (chicken io)
(chicken port) (chicken file) (chicken file posix)
(chicken fixnum) (chicken string) (chicken process)
- (chicken process signal) srfi-18 llrb-fixnum-table))
+ (chicken bitwise) (chicken process signal)
+ srfi-18 llrb-fixnum-table))
(else (import chicken)
(use data-structures (rename extras (read-file read-list))
utils files ports posix srfi-1 srfi-18)
@@ -370,7 +371,11 @@
(define (run/file* thunk)
(let ((temp-file (create-temporary-file)))
(wait (fork (lambda ()
- (let ((fd (file-open temp-file open/wronly)))
+ (let ((fd (file-open temp-file
+ open/wronly
+ (bitwise-ior perm/irusr perm/iwusr
+ perm/irgrp perm/iwgrp
+ perm/iroth perm/iwoth))))
(duplicate-fileno fd 1)
(with-output-to-port (open-output-file* 1) thunk)))))
temp-file))
@@ -449,14 +454,24 @@
((_ (> ?fd ?file-name))
(duplicate-fileno
(file-open (maybe->string `?file-name)
- (fx+ (fx+ open/wronly open/creat) open/trunc))
+ (fx+ (fx+ open/wronly open/creat) open/trunc)
+ (bitwise-ior perm/irusr perm/iwusr
+ perm/irgrp perm/iwgrp
+ perm/iroth perm/iwoth))
`?fd))
((_ (>> ?fd ?file-name))
(duplicate-fileno (file-open (maybe->string `?file-name)
- (fx+ open/wronly (fx+ open/append open/creat)))
+ (fx+ open/wronly (fx+ open/append open/creat))
+ (bitwise-ior perm/irusr perm/iwusr
+ perm/irgrp perm/iwgrp
+ perm/iroth perm/iwoth))
`?fd))
((_ (< ?fd ?file-name))
- (duplicate-fileno (file-open (maybe->string `?file-name) open/rdonly)
+ (duplicate-fileno (file-open (maybe->string `?file-name)
+ open/rdonly
+ (bitwise-ior perm/irusr perm/iwusr
+ perm/irgrp perm/iwgrp
+ perm/iroth perm/iwoth))
`?fd))
((_ (<< ?fd ?object))
(fork/pipe+ `((1 ?fd)) (lambda () (display `?object (open-output-file* 1)))))