| 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:
M sfeed_update | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- |
| @@ -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. |