changeset 609:4e7490f809c8

Fix: If file is not exist it open file as "/suydo::" in TRAMP but should open as from regular user to preserve ownership.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Sat, 16 Jan 2016 23:09:52 +0200
parents 04a2f06f92d8
children 92f77b6d0d99
files emacs/e
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/emacs/e	Thu Dec 31 23:16:51 2015 +0200
+++ b/emacs/e	Sat Jan 16 23:09:52 2016 +0200
@@ -30,7 +30,8 @@
 fi
 
 f=`readlink -f "$1"`
-if [ -e "$f" ] && [ ! -w "$f" ] || [ -e "${f%/*}" ] && [ ! -w $f ]; then
+d="${f%/*}"
+if [ -e "$f" ] && [ ! -w "$f" ] || [ -e "$d" ] && [ ! -w "$d" ]; then
     shift
     exec emacsclient $args -- "/sudo::$f" "$@"
 fi