diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-06-13 17:52:08 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-06-13 18:05:54 +0200 |
commit | 1752a17a1e6f7138892eeeb4806cd04ccb3ca1b0 (patch) | |
tree | b214b397e41996725a20c81da83bc4cd4187383e /guix/utils.scm | |
parent | 9f8ee3fe0ed615a89520618c4df66647845b15b3 (diff) | |
download | gnu-guix-1752a17a1e6f7138892eeeb4806cd04ccb3ca1b0.tar gnu-guix-1752a17a1e6f7138892eeeb4806cd04ccb3ca1b0.tar.gz |
utils: 'with-atomic-file-output' calls 'fdatasync'.
Suggested by Danny Milosavljevic <dannym@scratchpost.org>
at <https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00456.html>.
* guix/build/syscalls.scm (fdatasync): New procedure.
* guix/utils.scm (with-atomic-file-output): Use it. Use 'close-port'
instead of 'close'.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r-- | guix/utils.scm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/guix/utils.scm b/guix/utils.scm index c77da5d846..18d913c514 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -34,7 +34,7 @@ #:use-module ((rnrs bytevectors) #:select (bytevector-u8-set!)) #:use-module (guix combinators) #:use-module ((guix build utils) #:select (dump-port)) - #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build syscalls) #:select (mkdtemp! fdatasync)) #:use-module (ice-9 vlist) #:use-module (ice-9 format) #:autoload (ice-9 popen) (open-pipe*) @@ -625,7 +625,8 @@ output port, and PROC's result is returned." (with-throw-handler #t (lambda () (let ((result (proc out))) - (close out) + (fdatasync out) + (close-port out) (rename-file template file) result)) (lambda (key . args) |