tscrape_update: don't preserve permissions of tmp files by moving, so copy - ts… | |
git clone git://git.codemadness.org/tscrape | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e22be126773aae620aadb29b9757824dc1060868 | |
parent 1b03719564afdb0ba61fa1599d0cb796e10d6ed9 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 23 Feb 2020 20:18:01 +0100 | |
tscrape_update: don't preserve permissions of tmp files by moving, so copy | |
noticed on DragonFlyBSD where it prints a warning when moving the file from | |
/tmp. | |
To reproduce it: | |
touch /tmp/file | |
mv /tmp/file ~/ | |
On other systems this would not print a warning, but it would preserve the | |
group permissions etc. | |
Diffstat: | |
M tscrape_update | 7 ++++--- | |
1 file changed, 4 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/tscrape_update b/tscrape_update | |
@@ -121,11 +121,12 @@ feed() { | |
fi | |
rm -f "${tmpfeedfile}.merge" | |
- # atomic move. | |
- if ! mv "${tmpfeedfile}.order" "${tscrapefile}"; then | |
- log "${name}" "FAIL (MOVE)" | |
+ # copy | |
+ if ! cp "${tmpfeedfile}.order" "${tscrapefile}"; then | |
+ log "${name}" "FAIL (COPY)" | |
return | |
fi | |
+ rm -f "${tmpfeedfile}.order" | |
# OK | |
log "${name}" "OK" |