From a1c503c6e4f415743a65faa41e8990e647841386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sat, 19 Nov 2016 02:07:49 +0100 Subject: [PATCH] io.files.info.unix.linux: handles the possible permission denied error in M: linux file-systems --- basis/io/files/info/unix/linux/linux.factor | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/basis/io/files/info/unix/linux/linux.factor b/basis/io/files/info/unix/linux/linux.factor index c51a21b599..dd04aecf6d 100644 --- a/basis/io/files/info/unix/linux/linux.factor +++ b/basis/io/files/info/unix/linux/linux.factor @@ -1,9 +1,10 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs classes.struct combinators csv -io.backend io.encodings.utf8 io.files.info io.files.info.unix -io.pathnames kernel libc math math.parser sequences splitting -strings system unix.statfs.linux unix.statvfs.linux ; +USING: accessors assocs classes.struct combinators +combinators.short-circuit continuations csv fry io.backend +io.encodings.utf8 io.files.info io.files.info.unix io.pathnames kernel +libc math math.parser sequences splitting strings system +unix.statfs.linux unix.statvfs.linux ; FROM: csv => delimiter ; IN: io.files.info.unix.linux @@ -67,15 +68,18 @@ frequency pass-number ; CHAR: \s [ "/etc/mtab" utf8 file>csv ] with-delimiter [ mtab-csv>mtab-entry ] map ; -M: linux file-systems - parse-mtab [ - [ mount-point>> file-system-info ] keep +: mtab-entry>file-system-info ( mtab-entry -- file-system-info/f ) + '[ + _ [ mount-point>> file-system-info ] keep { [ file-system-name>> >>device-name ] [ mount-point>> >>mount-point ] [ type>> >>type ] } cleave - ] map ; + ] [ { [ libc-error? ] [ errno>> EACCES = ] } 1&& ] ignore-error/f ; + +M: linux file-systems + parse-mtab [ mtab-entry>file-system-info ] map sift ; : (find-mount-point) ( path mtab-paths -- mtab-entry ) 2dup at* [