> On Tue, Jul 19, 2016, 19:36 mitfree <[email protected]> wrote:
> 
> +( mktemp -d "/tmp/passmenu."$userID".XXXXXXXXXX"."$$".lock >/dev/null
> 2>&1 && cleanup=True ||
>    { echo >&2 ":: Unable to make a filelock."; exit 1; } )
..
>     +    rmdir /tmp/passmenu.*.*."$$".lock >/dev/null 2>&1
..
>     +    rmdir /tmp/passmenu."$userID".* >/dev/null 2>&1 ||


Quoting Marcos Alano (2016-07-19 18:45:03)
> Could be a file instead of a folder.


One of the nice things about rmdir is that it will error on non-empty.
Since there is a bash variable in the basename, I was extra careful about
unintentionally removing the wrong file. We want to prevent the unlikely 
situation
where through some unforeseen bash bug an environmental variable could be pass 
'../'

Even though I also hard code '/tmp/passmenu.', I'm just not positive
that it couldn't be escaped, sometime in the future. That's why I went
with a directory.
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to