guix-commits
[Top][All Lists]
Advanced

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

01/01: list-runtime-roots: Ignore PIDs we cannot access.


From: Ludovic Courtès
Subject: 01/01: list-runtime-roots: Ignore PIDs we cannot access.
Date: Sun, 12 Nov 2017 17:53:17 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 856b68bda959638201182304ded2759c7de5411b
Author: Ludovic Courtès <address@hidden>
Date:   Sun Nov 12 23:52:18 2017 +0100

    list-runtime-roots: Ignore PIDs we cannot access.
    
    This allows running as non-root.
    Fixes a regression introduced in b8f59cdc20e9d83ce63523ef917e95fcee07f134.
    
    * nix/scripts/list-runtime-roots.in (referenced-files): Handle EACCES in
    addition to ENOENT.
---
 nix/scripts/list-runtime-roots.in | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/nix/scripts/list-runtime-roots.in 
b/nix/scripts/list-runtime-roots.in
index 001d25c..511789a 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))))))



reply via email to

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