diff --git a/collects/mzlib/os.ss b/collects/mzlib/os.ss index 960aff2403..9580d7dbd2 100644 --- a/collects/mzlib/os.ss +++ b/collects/mzlib/os.ss @@ -115,6 +115,11 @@ val (fail-k))) + (define scheme_security_check_file + (delay-ffi-obj "scheme_security_check_file" #f + (_fun _string _string _int -> _void))) + (define SCHEME_GUARD_FILE_WRITE #x2) + ;; truncate-file : path int -> void (define truncate-file (opt-lambda (file [size 0]) @@ -122,6 +127,10 @@ (error 'truncate-file "expects argument of type or ; given ~s" file)) (when (not (integer? size)) (error 'truncate-file "expects argument of type ; given ~s" size)) + ((force scheme_security_check_file) + "truncate-file" + (if (path? file) (path->string file) file) + SCHEME_GUARD_FILE_WRITE) (let ([fd (on-c-fail ((force open) file O_WRONLY) (lambda ()