aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-11-25 23:07:14 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-11-25 23:07:14 -0200
commitc7a382d0694d9333ac4221d5158f3fc7763f2452 (patch)
treeef707bafe44c34bb64724648a07230e230cc8077
parent1297148b7c48f8c9c6677c133ad8b22cd6572c0e (diff)
downloadkeyringer-c7a382d0694d9333ac4221d5158f3fc7763f2452.tar.gz
keyringer-c7a382d0694d9333ac4221d5158f3fc7763f2452.tar.bz2
Document ramdisk check and fix typ0 at keyringer_check_tmp
-rwxr-xr-xlib/keyringer/functions12
1 files 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