Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote: > On Tue, Oct 22, 2024 at 04:09:54PM +0200, Florian Westphal wrote: > > tmpfile1=$(mktemp -p .) > > -if [ ! -w $tmpfile1 ] ; then > > +if [ ! -w "$tmpfile1" ] ; then > > echo "Failed to create tmp file" >&2 > > - exit 0 > > + exit 77 > > fi > > > > +trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted > > +set -e > > + > > tmpfile2=$(mktemp -p .) > > -if [ ! -w $tmpfile2 ] ; then > > +if [ ! -w "$tmpfile2" ] ; then > > echo "Failed to create tmp file" >&2 > > exit 0 > > this does not return 77, see below... I only changed first invocation, if pwd is ro, that will have failed already. I can make that consistent if you prefer.