From c7a382d0694d9333ac4221d5158f3fc7763f2452 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 25 Nov 2013 23:07:14 -0200 Subject: Document ramdisk check and fix typ0 at keyringer_check_tmp --- lib/keyringer/functions | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 828cb31..8bad9ed 100755 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -114,7 +114,7 @@ function keyringer_is_git { # Check the security of a temporary folder function keyringer_check_tmp { local path="$1" - local minor + local major local mode if [ -z "$path" ]; then @@ -127,14 +127,16 @@ function keyringer_check_tmp { fi # Ramdisk check + # Non-device mounts have major number "0", see + # https://www.kernel.org/doc/Documentation/devices.txt if [ -x "/sbin/udevadm" ]; then - minor="$(/sbin/udevadm info --device-id-of-file "$path" | cut -d : -f 1)" + major="$(/sbin/udevadm info --device-id-of-file "$path" | cut -d : -f 1)" elif which mountpoint &> /dev/null; then - minor="$(mountpoint -d $(df "$path" | sed -n '$p' | awk '{print $NF}') | cut -d : -f 1)" + major="$(mountpoint -d $(df "$path" | sed -n '$p' | awk '{print $NF}') | cut -d : -f 1)" fi - if [ ! -z "$minor" ]; then - return $minor + if [ ! -z "$major" ]; then + return $major else return 1 fi -- cgit v1.2.3