jaromail

a commandline tool to easily and privately handle your e-mail
git clone git://parazyd.org/jaromail.git
Log | Files | Refs | Submodules | README

commit d51213e7e721ab29f7b68071d990246301b21358
parent ae369db8889baf1ab0c18566d200b847b9025d22
Author: Jaromil <jaromil@dyne.org>
Date:   Tue, 28 Aug 2012 03:01:55 +0200

better checks for file existance

Diffstat:
Msrc/zlibs/locking | 8++++----
Msrc/zlibs/search | 2+-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/zlibs/locking b/src/zlibs/locking @@ -44,7 +44,7 @@ newlock() { # create locked unlock() { func "unlock: $1" lockpid="`cat ${1}.pid`" - { test -r ${1}.pid } && { + { test -r "${1}.pid" } && { { test "$$" != "$lockpid" } && { error "Unlock attempt by different PID: $1" error "Created by $lockpid now $$ is trying to unlock" @@ -53,7 +53,7 @@ unlock() { $WORKDIR/bin/dotlock -u ${=@} { test $? != 0 } && { error "Unable to unlock: $1"; return 1 } - { test -r ${1}.pid } && { rm -f ${1}.pid } + { test -r "${1}.pid" } && { rm -f ${1}.pid } return 0 } unlink() { # delete a file that we are locking @@ -61,7 +61,7 @@ unlink() { # delete a file that we are locking # use with care! this can permanently erase currently locked files # only the locking PID should use it on its own locks - { test -r ${1}.pid } && { + { test -r "${1}.pid" } && { lockpid="`cat ${1}.pid`" { test "$$" != "$lockpid" } && { error "Unlock attempt by different PID: $1" @@ -74,7 +74,7 @@ unlink() { # delete a file that we are locking touch ${1} $WORKDIR/bin/dotlock -d -f ${1} { test $? != 0 } && { error "Unable to unlink: $1"; return 1 } - { test -r ${1}.pid } && { rm -f ${1}.pid } + { test -r "${1}.pid" } && { rm -f ${1}.pid } ) &! return 0 } diff --git a/src/zlibs/search b/src/zlibs/search @@ -219,7 +219,7 @@ backup() { } dst=${fold[${#fold}]} - { test -r $dst } && { + { test -r "$dst" } && { error "Backup destination already exists: $dst" return 1 }