From abbd53c57a0fa52d315098c819f6ea3d7da8be4a Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Mon, 30 Jul 2018 07:36:26 +0100 Subject: return the exit value of cgi --- gosher | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gosher b/gosher index feda798..e896ae6 100755 --- a/gosher +++ b/gosher @@ -211,7 +211,7 @@ serve_cgi(){ PATH_TRANSLATED="${script_name}" [ -n "${QUERY_STRING}" ] && QUERY_STRING="${query_string}" REMOTE_ADDR= - REMOTE_HOST="${REMOTE_ADDR}" + REMOTE_HOST= REQUEST_METHOD="GET" SCRIPT_NAME="${script_name}" SERVER_NAME="${HOSTNAME}" @@ -223,7 +223,7 @@ serve_cgi(){ export REMOTE_ADDR REMOTE_HOST REQUEST_METHOD SCRIPT_NAME export SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE ${GOPHERDIR}${script_name} "" "${query_string}" "${HOSTNAME}" "${PORT}" 2>&1 - exit 0 + exit $? } @@ -263,11 +263,11 @@ case $selector in echo "iRP2: ${RP2}" } - if [ "${RP1}" = "${RP2}" ]; then + [ "${RP1}" = "${RP2}" ] && { [ -x "${RP1}" ] && { serve_cgi "${script_name}" "${query_string}" } - fi + } invalid_selector "${selector}" ;; /?*|"") -- cgit v1.2.3