~ruther/guix-local

856b68bda959638201182304ded2759c7de5411b — Ludovic Courtès 8 years ago d0b8777
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.
1 files changed, 5 insertions(+), 4 deletions(-)

M nix/scripts/list-runtime-roots.in
M nix/scripts/list-runtime-roots.in => nix/scripts/list-runtime-roots.in +5 -4
@@ 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))))))