From 812ab3dc1031f34dc001339f2cb9864fd7c09a70 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 26 Nov 2013 13:02:58 -0200 Subject: Simpler ramdisk/tmpfs check at keyringer_check_tmp --- lib/keyringer/functions | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 667b0cd..a278caf 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 major + local mount # Mode check if [ -z "$path" ] || [ ! -d "$path" ] || [ ! -w "$path" ] || [ ! -x "$path" ]; then @@ -122,19 +122,9 @@ 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 - major="$(/sbin/udevadm info --device-id-of-file "$path" | cut -d : -f 1)" - elif which mountpoint &> /dev/null; then - major="$(mountpoint -d $(df "$path" | sed -n '$p' | awk '{print $NF}') | cut -d : -f 1)" - fi - - if [ ! -z "$major" ]; then - return $major - else - return 1 - fi + mount="`df "$path" | sed -n '$p' | awk '{ print $NF }'`" + mount -l -t tmpfs | awk '{ print $3 }' | grep -q -e "^$mount$"; + return $? } # Setup a temporary file -- cgit v1.2.3