]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Document ramdisk check and fix typ0 at keyringer_check_tmp
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Nov 2013 01:07:14 +0000 (23:07 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Nov 2013 01:07:14 +0000 (23:07 -0200)
lib/keyringer/functions

index 828cb31d9d845129bf9e8dc0d8990ee6beae3278..8bad9edf8f43a74ecf1aac7c4690510356017d44 100755 (executable)
@@ -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