From 318867de22a49dc1e348cc1173ee4cdeb977d7b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 16 Jul 2018 10:46:38 +0200 Subject: [PATCH] localize fucntion variables --- cgilite.sh | 1 + file.sh | 6 +++--- storage.sh | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cgilite.sh b/cgilite.sh index b936e47..2930a4c 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -186,6 +186,7 @@ PATH(){ SET_COOKIE(){ + local expire cookie case "$1" in ''|0|session) expire='';; [+-][0-9]*) expire="$(date -R -d @$(($(date +%s) + $1)))";; diff --git a/file.sh b/file.sh index 06f28d0..084b7e6 100755 --- a/file.sh +++ b/file.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/sh # Copyright 2016 - 2018 Paul Hänsch # @@ -40,7 +40,7 @@ file_type(){ } FILE(){ - unset range file_size file_date http_date cachedate + local file file_size file_date http_date cachedate range file="$1" if ! [ -f "$file" ]; then @@ -109,7 +109,7 @@ FILE(){ [ "$REQUEST_METHOD" != HEAD ] \ && tail -c+$((${range%-*} + 1)) "$file" \ - | head -c "$((${range#*-} - ${range%-*} + 1))" + | head -c "$((${range#*-} - ${range%-*} + 1))" elif [ "${range%-*}" -gt "${range#*-}" ]; then printf '%s: %s\r\n' \ diff --git a/storage.sh b/storage.sh index 8bd1b95..a6b6b43 100755 --- a/storage.sh +++ b/storage.sh @@ -21,6 +21,7 @@ include_storage="$0" LOCK(){ + local lock timeout block lock="${1}.lock" timeout="${2-20}" if [ \! -w "${lock%/*}" ] || [ -e "$lock" -a \! -d "$lock" ]; then @@ -46,6 +47,7 @@ LOCK(){ } RELEASE(){ + local lock lock="${1}.lock" if [ "$(cat "$lock/pid")" = "$$" ]; then rm "$lock/pid" -- 2.39.2