diff --git a/tomb b/tomb index 0fc23de..611eae8 100755 --- a/tomb +++ b/tomb @@ -131,14 +131,11 @@ check_shm() { || { # mount the tmpfs if the SO doesn't already mkdir /run/shm - [[ $? = 0 ]] || { - fatal "Fatal error creating a directory for temporary files" - return 1 } + (( $? )) && _failure "Fatal error creating a directory for temporary files" + mount -t tmpfs tmpfs /run/shm \ -o nosuid,noexec,nodev,mode=0600,uid="$_uid",gid="$_gid" - [[ $? = 0 ]] || { - fatal "Fatal error mounting tmpfs in /run/shm for temporary files" - return 1 } + (( $? )) && _failure "Fatal error mounting tmpfs in /run/shm for temporary files" SHMPREFIX=/run/shm } @@ -153,14 +150,12 @@ check_shm() { tmp_create() { local tfile="${TMPPREFIX}${RANDOM}" touch "$tfile" - [[ $? = 0 ]] || { - fatal "Fatal error creating a temporary file: ::1 temp file::" $tfile - return 1 } + (( $? )) && _failure "Fatal error creating a temporary file: ::1 temp file::" $tfile + chown "$_uid":"$_gid" "$tfile" chmod 0600 "$tfile" - [[ $? = 0 ]] || { - fatal "Fatal error setting permissions on temporary file: ::1 temp file::" $tfile - return 1 } + (( $? )) && _failure "Fatal error setting permissions on temporary file: ::1 temp file::" $tfile + _verbose "Created tempfile: ::1 temp file::" $tfile tomb_tempfiles+=($tfile) return 0