summary refs log tree commit diff
path: root/nix/scripts/list-runtime-roots.in
diff options
context:
space:
mode:
Diffstat (limited to 'nix/scripts/list-runtime-roots.in')
-rw-r--r--nix/scripts/list-runtime-roots.in9
1 files changed, 5 insertions, 4 deletions
diff --git a/nix/scripts/list-runtime-roots.in b/nix/scripts/list-runtime-roots.in
index 001d25c577..511789a539 100644
--- a/nix/scripts/list-runtime-roots.in
+++ b/nix/scripts/list-runtime-roots.in
@@ -119,10 +119,11 @@ or the empty list."
                               (proc-maps-roots proc)
                               (proc-environ-roots proc)))
                     (lambda args
-                      ;; There's a TOCTTOU race that we need to handle.
-                      (if (= ENOENT (system-error-errno args))
-                          '()
-                          (apply throw args))))))
+                      (let ((err (system-error-errno args)))
+                        (if (or (= ENOENT err)    ;TOCTTOU race
+                                (= EACCES err))   ;not running as root
+                            '()
+                            (apply throw args)))))))
               (scandir %proc-directory string->number
                        (lambda (a b)
                          (< (string->number a) (string->number b))))))