From 843c551810f868d72eda011c286229635fbee4a9 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 28 Jan 2015 15:41:50 +0100 Subject: sfeed_update: pass file for curl time condition (last modified) this fixes an issue with differences in stat(1) versions (OpenBSD, GNU, sbase). --- sfeed_update | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'sfeed_update') diff --git a/sfeed_update b/sfeed_update index 334c58e..6d029e7 100755 --- a/sfeed_update +++ b/sfeed_update @@ -42,9 +42,9 @@ merge() { } # fetch a feed via HTTP/HTTPS etc. -# fetchfeed(url, name, lastupdated) +# fetchfeed(url, name) fetchfeed() { - if curl -f -s -S -L --max-time 15 -z "$3" "$1"; then + if curl -f -s -S -L --max-time 15 -z "$sfeedfile" "$1"; then printf " OK %s %s\n" "`date +'%H:%M:%S'`" "$2" >&2 else printf "FAIL %s %s\n" "`date +'%H:%M:%S'`" "$2" >&2 @@ -70,11 +70,10 @@ feed() { tmpencfile="" encoding="$4" if [ ! "$encoding" = "" ]; then - fetchfeed "$2" "$1" "$lastupdated" | \ - convertencoding "$encoding" "utf-8" + fetchfeed "$2" "$1" | convertencoding "$encoding" "utf-8" else # detect encoding. tmpencfile=$(mktemp -p "$TMPDIR") - fetchfeed "$2" "$1" "$lastupdated" > "$tmpencfile" + fetchfeed "$2" "$1" > "$tmpencfile" detectenc=$(sfeed_xmlenc < "$tmpencfile") convertencoding "$detectenc" "utf-8" < "$tmpencfile" rm -f "$tmpencfile" @@ -99,10 +98,6 @@ feeds() { loadconfig "$1" # fetch feeds and store in temporary file. TMPDIR=$(mktemp -d "/tmp/sfeed_XXXXXX") -# get date of last modified feedfile in format: -# YYYYmmdd HH:MM:SS [+-][0-9]* -lastupdated=$(stat -c "%y" "$sfeedfile" 2> /dev/null | \ - cut -c 1-4,6-7,9-10,11-19,30-) # kill whole current process group on ^C. isrunning="1" # SIGTERM: signal to terminate parent. -- cgit v1.2.3