Skip to content

Commit

Permalink
Merge pull request #2 from DeeNewcum/master
Browse files Browse the repository at this point in the history
Remove unencrypted temp if original isn't writable
  • Loading branch information
ptarjan committed Aug 7, 2012
2 parents d8edf7a + 6bcb8a7 commit cc679eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions viencrypt
Expand Up @@ -11,7 +11,7 @@ else
fi

# more security for vi
if [ $editor == "vi" -o $editor == "vim" ]
if [ $editor = "vi" -o $editor = "vim" ]
then
# -n is for noswap and -i NONE is for no .viminfo
editor="$editor -n -i NONE"
Expand Down Expand Up @@ -72,8 +72,12 @@ fi
$editor $tmp

# write changes back out
if [ -w $filename -o ! -f $filename ]
if [ -e $filename -a ! -w $filename ]
then
# the original file is unwritable, and can't be updated
chmod +w $tmp
$rm $tmp
else
echo "$passw" | gpg -q -c --batch --passphrase-fd 0 --output $filename --yes --force-mdc $tmp
$rm $tmp
if [ $? != 0 ]; then
Expand Down

0 comments on commit cc679eb

Please sign in to comment.