Do not try to remove abstract UNIX socket entries after use

This commit is contained in:
Gerhard Rieger 2023-06-12 21:29:45 +02:00
parent 2dadc1010f
commit 920d77847d
3 changed files with 44 additions and 26 deletions

View file

@ -59,6 +59,8 @@ Corrections:
The mechanism for deferring logs from signal handlers had an issue that
caused lots of unwanted recvfrom() calls.
Do not try to remove abstract UNIX socket entries after use.
Features:
VSOCK, VSOCK-L support options pf, socktype, prototype (currently
useless)

58
test.sh
View file

@ -9633,22 +9633,29 @@ echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
rc2=$?
kill "$pid1" 2>/dev/null; wait
if [ $rc2 -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &"
cat "${te}1"
echo "$CMD2"
cat "${te}2"
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
$PRINTF "$FAILED\n"
cat "$tdiff"
$PRINTF "$FAILED\n"
echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
cat "$tdiff" >&2
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
else
$PRINTF "$OK\n"
if [ -n "$debug" ]; then cat $te; fi
numOK=$((numOK+1))
$PRINTF "$OK\n"
if [ "$VERBOSE" ]; then echo "$CMD1 &"; fi
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
if [ "$VERBOSE" ]; then echo "$CMD2"; fi
if [ "$DEBUG" ]; then cat "${te}2" >&2; fi
numOK=$((numOK+1))
fi
fi ;; # NUMCOND, feats
esac
@ -9684,22 +9691,29 @@ rc2="$?"
i=0; while [ ! -s "$tf" -a "$i" -lt 10 ]; do usleep 100000; i=$((i+1)); done
kill "$pid1" 2>/dev/null; wait
if [ "$rc2" -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &"
echo "$CMD2"
cat "${te}1"
cat "${te}2"
$PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
$PRINTF "$FAILED\n"
cat "$tdiff"
$PRINTF "$FAILED\n"
echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
cat "$tdiff"
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
else
$PRINTF "$OK\n"
if [ -n "$debug" ]; then cat $te; fi
numOK=$((numOK+1))
$PRINTF "$OK\n"
if [ "$VERBOSE" ]; then echo "$CMD1 &"; fi
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
if [ "$VERBOSE" ]; then echo "$CMD2"; fi
if [ "$DEBUG" ]; then cat "${te}2" >&2; fi
numOK=$((numOK+1))
fi
fi ;; # NUMCOND, feats
esac
@ -9732,13 +9746,15 @@ echo "$da" |$CMD1 >$tf 2>"${te}1"
rc1=$?
if [ $rc1 -ne 0 ]; then
$PRINTF "$FAILED\n"
echo "$CMD1" >&2
echo "$CMD1"
echo "rc=$rc1" >&2
cat "${te}1" >&2
numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N"
elif echo "$da" |diff -q - $tf; then
$PRINTF "$OK\n"
if [ "$VERBOSE" ]; then echo "$CMD1 &"; fi
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
numOK=$((numOK+1))
else
$PRINTF "$FAILED\n"

View file

@ -127,7 +127,7 @@ static int xioopen_unix_listen(int argc, const char *argv[], struct opt *opts, i
struct opt *opts0 = NULL;
pid_t pid = Getpid();
bool opt_unlink_early = false;
bool opt_unlink_close = true;
bool opt_unlink_close = (abstract != 1);
int result;
if (argc != 2) {
@ -217,7 +217,7 @@ static int xioopen_unix_connect(int argc, const char *argv[], struct opt *opts,
struct sockaddr_un them, us;
socklen_t themlen, uslen = sizeof(us);
bool needbind = false;
bool opt_unlink_close = true;
bool opt_unlink_close = (abstract != 1);
bool dofork = false;
struct opt *opts0;
char infobuff[256];
@ -365,7 +365,7 @@ static int xioopen_unix_sendto(int argc, const char *argv[], struct opt *opts, i
union sockaddr_union us;
socklen_t uslen = sizeof(us);
bool needbind = false;
bool opt_unlink_close = true;
bool opt_unlink_close = (abstract != 1);
if (argc != 2) {
Error2("%s: wrong number of parameters (%d instead of 1)",
@ -429,7 +429,7 @@ int xioopen_unix_recvfrom(int argc, const char *argv[], struct opt *opts,
socklen_t uslen;
bool needbind = true;
bool opt_unlink_early = false;
bool opt_unlink_close = true;
bool opt_unlink_close = (abstract != 1);
if (argc != 2) {
Error2("%s: wrong number of parameters (%d instead of 1)",
@ -514,7 +514,7 @@ int xioopen_unix_recv(int argc, const char *argv[], struct opt *opts,
union sockaddr_union us;
socklen_t uslen;
bool opt_unlink_early = false;
bool opt_unlink_close = true;
bool opt_unlink_close = (abstract != 1);
int result;
if (argc != 2) {