Skip to content

Commit

Permalink
remove socket err temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
neil committed Feb 4, 2024
1 parent bd6bbba commit e04093e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions acme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2519,19 +2519,19 @@ _startserver() {
_content_len="$(printf "%s" "$content" | wc -c)"
_debug _content_len "$_content_len"
_debug "_NC" "$_NC $SOCAT_OPTIONS"
_socaterr="$(_mktemp)"
export _SOCAT_ERR="$(_mktemp)"
$_NC $SOCAT_OPTIONS SYSTEM:"sleep 1; \
echo 'HTTP/1.0 200 OK'; \
echo 'Content-Length\: $_content_len'; \
echo ''; \
printf '%s' '$content';" 2>"$_socaterr" &
printf '%s' '$content';" 2>"$_SOCAT_ERR" &
serverproc="$!"
if [ -f "$_socaterr" ]; then
if grep "Permission denied" "$_socaterr" >/dev/null; then
_err "socat: $(cat $_socaterr)"
if [ -f "$_SOCAT_ERR" ]; then
if grep "Permission denied" "$_SOCAT_ERR" >/dev/null; then
_err "socat: $(cat $_SOCAT_ERR)"
_err "Can not listen for user: $(whoami)"
_err "Maybe try with root again?"
rm -f "$_socaterr"
rm -f "$_SOCAT_ERR"
return 1
fi
fi
Expand All @@ -2541,10 +2541,12 @@ _stopserver() {
pid="$1"
_debug "pid" "$pid"
if [ -z "$pid" ]; then
rm -f "$_SOCAT_ERR"
return
fi

kill $pid
rm -f "$_SOCAT_ERR"

}

Expand Down

0 comments on commit e04093e

Please sign in to comment.