From 5a27c58675ddf4113d64a84f715cb3fecb681a6d Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 5 Apr 2023 21:41:19 +0200 Subject: 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. --- sfeed_update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfeed_update b/sfeed_update index f989be6..3da45d3 100755 --- 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. -- cgit v1.2.3