diff --git a/scsh/filesys.scm b/scsh/filesys.scm index 68de00e..4c522f9 100644 --- a/scsh/filesys.scm +++ b/scsh/filesys.scm @@ -119,3 +119,16 @@ (list cwd-resource euid-resource egid-resource) (lambda () (%rename-file old-fname new-fname)))))) + +(define (read-symlink path) + (with-resources-aligned + (list cwd-resource euid-resource egid-resource) + (lambda () + (%read-symlink path)))) + + +(define (delete-directory path) + (with-resources-aligned + (list cwd-resource euid-resource egid-resource) + (lambda () + (%delete-directory path)))) \ No newline at end of file diff --git a/scsh/syscalls.scm b/scsh/syscalls.scm index 5b538ee..d25e14f 100644 --- a/scsh/syscalls.scm +++ b/scsh/syscalls.scm @@ -243,11 +243,11 @@ (fname (ensure-file-name-is-nondirectory path))) (%%create-directory fname mode))) -(import-os-error-syscall read-symlink (path) "scsh_readlink") +(import-os-error-syscall %read-symlink (path) "scsh_readlink") (import-os-error-syscall %rename-file (old-name new-name) "scsh_rename") -(import-os-error-syscall delete-directory (path) "scsh_rmdir") +(import-os-error-syscall %delete-directory (path) "scsh_rmdir") (import-os-error-syscall %utime (path ac m) "scm_utime") @@ -256,15 +256,18 @@ ;;; (SET-FILE-TIMES path [access-time mod-time]) (define (set-file-times path . maybe-times) - (if (pair? maybe-times) - (let* ((access-time (real->exact-integer (car maybe-times))) - (mod-time (if (pair? (cddr maybe-times)) - (error "Too many arguments to set-file-times/errno" - (cons path maybe-times)) - (real->exact-integer (cadr maybe-times))))) - (%utime path access-time - mod-time )) - (%utime-now path))) + (with-resources-aligned + (list cwd-resource euid-resource egid-resource) + (lambda () + (if (pair? maybe-times) + (let* ((access-time (real->exact-integer (car maybe-times))) + (mod-time (if (pair? (cddr maybe-times)) + (error "Too many arguments to set-file-times/errno" + (cons path maybe-times)) + (real->exact-integer (cadr maybe-times))))) + (%utime path access-time + mod-time )) + (%utime-now path))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; STAT @@ -575,8 +578,12 @@ (define-record-resumer type/directory-stream #f) (define (open-directory-stream name) - (let ((dir (make-directory-stream name - (open-dir name)))) + (let ((dir (make-directory-stream + name + (with-resources-aligned + (list cwd-resource euid-resource egid-resource) + (lambda () + (open-dir name)))))) (add-finalizer! dir close-directory-stream) dir))