me
/
guix
Archived
1
0
Fork 0

home: symlink-manager: Avoid extra 'lstat' call.

* gnu/home/services/symlink-manager.scm (update-symlinks-script)[symlink-to-store?]:
Avoid extra 'lstat' call.
master
Ludovic Courtès 2022-02-18 17:31:10 +01:00
parent a81bb1e4bb
commit a3a76a8384
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 2 deletions

View File

@ -103,8 +103,13 @@ appear only after all nested items already listed."
(string-append backup-dir "/." path))
(define (symlink-to-store? path)
(and (equal? (stat:type (lstat path)) 'symlink)
(store-file-name? (readlink path))))
(catch 'system-error
(lambda ()
(store-file-name? (readlink path)))
(lambda args
(if (= EINVAL (system-error-errno args))
#f
(apply throw args)))))
(define (backup-file path)
(mkdir-p backup-dir)