changeset 598:7ae83c2a7ab5

Fix test if file writable by current user. Instead checking for ownership directly check for write permission.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 10 Dec 2015 13:36:39 +0200
parents eef72bd9ba9e
children b0859d9290ce
files emacs/e
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/emacs/e	Thu Dec 10 13:33:35 2015 +0200
+++ b/emacs/e	Thu Dec 10 13:36:39 2015 +0200
@@ -30,7 +30,7 @@
 fi
 
 f=`readlink -f "$1"`
-if [ -e "$f" ] && [ `stat -c %U "$f"` != $USER ] || [ -e "${f%/*}" ] && [ `stat -c %U "${f%/*}"` != $USER ]; then
+if [ -e "$f" ] && [ ! -w "$f" ] || [ -e "${f%/*}" ] && [ ! -w $f ]; then
     shift
     exec emacsclient $ERAGS -- "/sudo::$f" "$@"
 fi