better tests for file ownership. closes #24 and #25

This commit is contained in:
rupa committed 2011-04-27 03:19:27 -04:00
1 parent 85f1c2e73c
commit bad41c20ca
1 file changed
+1 -1
+1 -1
View File
@@ -25,7 +25,7 @@ z() {
local datafile="$HOME/.z"
# bail out if we don't own ~/.z (we're another user but our ENV is still set)
[ "$(ls -l "$datafile" | cut -d' ' -f 3)" = "$USER" ] || return
[ -f "$datafile" -a "$(stat -c %U "$datafile")" != "$USER" ] && return
# add entries
if [ "$1" = "--add" ]; then