summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2016-03-19 08:41:51 +0100
committerPeter Palfrader <peter@palfrader.org>2016-03-19 08:41:51 +0100
commita8aec94b90ee2c15bb69380ffb97b662c6d8b5bc (patch)
treec8d6fc43c410172f58c43e8ee2a73aa023245072
parentc32daa2096b18dec464f9934fba87c61bd13a214 (diff)
Only accept numbers from .publish.ttl files
-rwxr-xr-xpublish-purge9
1 files changed, 8 insertions, 1 deletions
diff --git a/publish-purge b/publish-purge
index ea65755..0be0fd7 100755
--- a/publish-purge
+++ b/publish-purge
@@ -57,7 +57,14 @@ cleanit()
d=$(readlink -f -- "$d")
if [ -e "$d/.publish.ttl" ]; then
- ttl="$(cat "$d/.publish.ttl")"
+ local newttl
+ newttl="$(cat "$d/.publish.ttl")"
+ if [ "$newttl" -eq "$newttl" ] 2>/dev/null; then
+ # if it is a number
+ ttl="$newttl"
+ else
+ [ "$optVerbose" -ge "1" ] && echo "Ignoring invalid TTL setting '$newttl' in $d"
+ fi
fi
if test_if_ancient "$d" "$ttl"; then