From 75fa4c18521cc5f4877ab427c1d16808ceb16848 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Tue, 10 Jul 2001 14:52:57 +0000 Subject: [PATCH] With-umask-align for the rest of the syscalls. --- scsh/newports.scm | 34 ++++++++++++++++++---------------- scsh/scsh-interfaces.scm | 2 ++ scsh/scsh.scm | 3 +++ scsh/syscalls.scm | 3 ++- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/scsh/newports.scm b/scsh/newports.scm index 1316407..2b8957b 100644 --- a/scsh/newports.scm +++ b/scsh/newports.scm @@ -328,12 +328,13 @@ ;;; replace rts/channel-port.scm begin (define (open-file fname flags . maybe-mode) (with-cwd-aligned - (let ((fd (apply open-fdes fname flags maybe-mode)) - (access (bitwise-and flags open/access-mask))) - ((if (or (= access open/read) (= access open/read+write)) - make-input-fdport - make-output-fdport) - fd 0)))) + (with-umask-aligned + (let ((fd (apply open-fdes fname flags maybe-mode)) + (access (bitwise-and flags open/access-mask))) + ((if (or (= access open/read) (= access open/read+write)) + make-input-fdport + make-output-fdport) + fd 0))))) (define (open-input-file fname . maybe-flags) (let ((flags (:optional maybe-flags 0))) @@ -635,16 +636,17 @@ (define (call-with-mumble-file open close) (lambda (string proc) (with-cwd-aligned - (let ((port #f)) - (dynamic-wind (lambda () - (if port - (warn "throwing back into a call-with-...put-file" - string) - (set! port (open string)))) - (lambda () (proc port)) - (lambda () - (if port - (close port)))))))) + (with-umask-aligned + (let ((port #f)) + (dynamic-wind (lambda () + (if port + (warn "throwing back into a call-with-...put-file" + string) + (set! port (open string)))) + (lambda () (proc port)) + (lambda () + (if port + (close port))))))))) ;;; replace rts/channel-port.scm begin (define call-with-input-file diff --git a/scsh/scsh-interfaces.scm b/scsh/scsh-interfaces.scm index 167dfaa..e21ed73 100644 --- a/scsh/scsh-interfaces.scm +++ b/scsh/scsh-interfaces.scm @@ -340,6 +340,8 @@ set-umask with-umask* (with-umask :syntax) + with-umask-aligned* + (with-umask-aligned :syntax) process-chdir process-cwd diff --git a/scsh/scsh.scm b/scsh/scsh.scm index bf4353b..3bd9613 100644 --- a/scsh/scsh.scm +++ b/scsh/scsh.scm @@ -411,6 +411,9 @@ (define-simple-syntax (with-cwd-aligned body ...) (with-cwd-aligned* (lambda () body ...))) +(define-simple-syntax (with-umask-aligned body ...) + (with-cwd-aligned* (lambda () body ...))) + (define-simple-syntax (with-umask mask . body) (with-umask* mask (lambda () . body))) diff --git a/scsh/syscalls.scm b/scsh/syscalls.scm index 4192dbd..b31f377 100644 --- a/scsh/syscalls.scm +++ b/scsh/syscalls.scm @@ -545,7 +545,8 @@ (define (open-fdes path flags . maybe-mode) ; mode defaults to 0666 (with-cwd-aligned - (%open path flags (:optional maybe-mode #o666)))) + (with-umask-aligned + (%open path flags (:optional maybe-mode #o666))))) (define-stubless-foreign pipe-fdes () "scheme_pipe")