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 The mechanism for deferring logs from signal handlers had an issue that
caused lots of unwanted recvfrom() calls. caused lots of unwanted recvfrom() calls.
Do not try to remove abstract UNIX socket entries after use.
Features: Features:
VSOCK, VSOCK-L support options pf, socktype, prototype (currently VSOCK, VSOCK-L support options pf, socktype, prototype (currently
useless) useless)

32
test.sh
View file

@ -9635,19 +9635,26 @@ kill "$pid1" 2>/dev/null; wait
if [ $rc2 -ne 0 ]; then if [ $rc2 -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n" $PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &" echo "$CMD1 &"
cat "${te}1" cat "${te}1" >&2
echo "$CMD2" echo "$CMD2"
cat "${te}2" cat "${te}2" >&2
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
$PRINTF "$FAILED\n" $PRINTF "$FAILED\n"
cat "$tdiff" echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
cat "$tdiff" >&2
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
else else
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ -n "$debug" ]; then cat $te; fi 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)) numOK=$((numOK+1))
fi fi
fi ;; # NUMCOND, feats fi ;; # NUMCOND, feats
@ -9686,19 +9693,26 @@ kill "$pid1" 2>/dev/null; wait
if [ "$rc2" -ne 0 ]; then if [ "$rc2" -ne 0 ]; then
$PRINTF "$FAILED: $TRACE $SOCAT:\n" $PRINTF "$FAILED: $TRACE $SOCAT:\n"
echo "$CMD1 &" echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2" echo "$CMD2"
cat "${te}1" cat "${te}2" >&2
cat "${te}2"
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
$PRINTF "$FAILED\n" $PRINTF "$FAILED\n"
echo "$CMD1 &"
cat "${te}1" >&2
echo "$CMD2"
cat "${te}2" >&2
cat "$tdiff" cat "$tdiff"
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
else else
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ -n "$debug" ]; then cat $te; fi 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)) numOK=$((numOK+1))
fi fi
fi ;; # NUMCOND, feats fi ;; # NUMCOND, feats
@ -9732,13 +9746,15 @@ echo "$da" |$CMD1 >$tf 2>"${te}1"
rc1=$? rc1=$?
if [ $rc1 -ne 0 ]; then if [ $rc1 -ne 0 ]; then
$PRINTF "$FAILED\n" $PRINTF "$FAILED\n"
echo "$CMD1" >&2 echo "$CMD1"
echo "rc=$rc1" >&2 echo "rc=$rc1" >&2
cat "${te}1" >&2 cat "${te}1" >&2
numFAIL=$((numFAIL+1)) numFAIL=$((numFAIL+1))
listFAIL="$listFAIL $N" listFAIL="$listFAIL $N"
elif echo "$da" |diff -q - $tf; then elif echo "$da" |diff -q - $tf; then
$PRINTF "$OK\n" $PRINTF "$OK\n"
if [ "$VERBOSE" ]; then echo "$CMD1 &"; fi
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
numOK=$((numOK+1)) numOK=$((numOK+1))
else else
$PRINTF "$FAILED\n" $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; struct opt *opts0 = NULL;
pid_t pid = Getpid(); pid_t pid = Getpid();
bool opt_unlink_early = false; bool opt_unlink_early = false;
bool opt_unlink_close = true; bool opt_unlink_close = (abstract != 1);
int result; int result;
if (argc != 2) { 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; struct sockaddr_un them, us;
socklen_t themlen, uslen = sizeof(us); socklen_t themlen, uslen = sizeof(us);
bool needbind = false; bool needbind = false;
bool opt_unlink_close = true; bool opt_unlink_close = (abstract != 1);
bool dofork = false; bool dofork = false;
struct opt *opts0; struct opt *opts0;
char infobuff[256]; 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; union sockaddr_union us;
socklen_t uslen = sizeof(us); socklen_t uslen = sizeof(us);
bool needbind = false; bool needbind = false;
bool opt_unlink_close = true; bool opt_unlink_close = (abstract != 1);
if (argc != 2) { if (argc != 2) {
Error2("%s: wrong number of parameters (%d instead of 1)", 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; socklen_t uslen;
bool needbind = true; bool needbind = true;
bool opt_unlink_early = false; bool opt_unlink_early = false;
bool opt_unlink_close = true; bool opt_unlink_close = (abstract != 1);
if (argc != 2) { if (argc != 2) {
Error2("%s: wrong number of parameters (%d instead of 1)", 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; union sockaddr_union us;
socklen_t uslen; socklen_t uslen;
bool opt_unlink_early = false; bool opt_unlink_early = false;
bool opt_unlink_close = true; bool opt_unlink_close = (abstract != 1);
int result; int result;
if (argc != 2) { if (argc != 2) {