guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/04: offload: Better report failure to create the GC root directory.


From: Ludovic Courtès
Subject: 04/04: offload: Better report failure to create the GC root directory.
Date: Thu, 05 Feb 2015 22:41:04 +0000

civodul pushed a commit to branch master
in repository guix.

commit 353e34a626a43f2fc4e278373b90b9e43a45082f
Author: Ludovic Courtès <address@hidden>
Date:   Thu Feb 5 23:36:23 2015 +0100

    offload: Better report failure to create the GC root directory.
    
    Suggested by Ricardo Wurmus <address@hidden>.
    
    * guix/scripts/offload.scm (register-gc-root)[script]: Replace
      'false-if-exception' with a finer-grain 'system-error handler.
      Provide the name of MACHINE in 'leave' error message.
---
 guix/scripts/offload.scm |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm
index e494500..e651257 100644
--- a/guix/scripts/offload.scm
+++ b/guix/scripts/offload.scm
@@ -310,7 +310,14 @@ hook."
        ;; directory.
        (let ((root-directory (string-append %state-directory
                                             "/gcroots/tmp")))
-         (false-if-exception (mkdir root-directory))
+         (catch 'system-error
+           (lambda ()
+             (mkdir root-directory))
+           (lambda args
+             (unless (= EEXIST (system-error-errno args))
+               (error "failed to create remote GC root directory"
+                      root-directory (system-error-errno args)))))
+
          (catch 'system-error
            (lambda ()
              (symlink ,file
@@ -331,7 +338,7 @@ hook."
         ;; Better be safe than sorry: if we ignore the error here, then FILE
         ;; may be GC'd just before we start using it.
         (leave (_ "failed to register GC root for '~a' on '~a' (status: ~a)~%")
-               file machine status)))))
+               file (build-machine-name machine) status)))))
 
 (define (remove-gc-roots machine)
   "Remove from MACHINE the GC roots previously installed with



reply via email to

[Prev in Thread] Current Thread [Next in Thread]