cookutils rev 1066
modules/compressor: compress_gif(): fix optimized files permissions
(don't use mktemp, because it set the rw------- permissions in /tmp)
(don't use mktemp, because it set the rw------- permissions in /tmp)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Jun 06 00:53:16 2018 +0300 (2018-06-06) |
parents | 2233dc83fc9e |
children | 9c90eaa721d2 |
files | modules/compressor |
line diff
1.1 --- a/modules/compressor Wed Jun 06 00:32:43 2018 +0300 1.2 +++ b/modules/compressor Wed Jun 06 00:53:16 2018 +0300 1.3 @@ -398,14 +398,13 @@ 1.4 1.5 if which gifsicle >/dev/null; then 1.6 the_log="$(mktemp)" 1.7 - j="$(mktemp)" 1.8 for i in $(IFS=$'\n' find $install -type f -name '*.gif'); do 1.9 unset IFS 1.10 # use intermediate file, if all well ($?=0), then substitute the original 1.11 - if gifsicle -O3 "$i" -o "$j" >> "$the_log" 2>&1; then 1.12 - mv "$j" "$i" 1.13 + if gifsicle -O3 "$i" -o "$i.$$" >> "$the_log" 2>&1; then 1.14 + mv "$i.$$" "$i" 1.15 else 1.16 - rm "$j" 1.17 + rm "$i.$$" 1.18 fi 1.19 done 1.20 else