commit 5a27c58675ddf4113d64a84f715cb3fecb681a6d
parent 92dfc055ce7a24bc8120c7eece3caca0ae84b653
Author: Hiltjo Posthuma <[email protected]>
Date: Wed, 5 Apr 2023 21:41:19 0200
sfeed_update: fail early if creating a temporary directory or status file fails
If creating a temporary directory for the feed files failed then $sfeedtmpdir
would be empty and it would try to:
mkdir -p "/feed"
touch "/feed/ok"
After failing it would also still try to process all the feeds.
Now just fail early.
mktemp or touch themselve will print the actual error to stderr.
Diffstat:
1 file changed, 2 insertions( ), 2 deletions(-)
diff --git a/sfeed_update b/sfeed_update
@@ -203,9 203,9 @@ main() {
# load config file.
loadconfig "$1"
# fetch feeds and store in temporary directory.
- sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')"
sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')" || exit 1
mkdir -p "${sfeedtmpdir}/feeds"
- touch "${sfeedtmpdir}/ok"
touch "${sfeedtmpdir}/ok" || exit 1
# make sure path exists.
mkdir -p "${sfeedpath}"
# fetch feeds specified in config file.