zdtm: add scm10 test for scm sent unix sk with closed sender

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

(cherry picked from commit a9b546c74f6c1e817b0790bd9621cc137bb719f3)
Signed-off-by: Ahmed Elaidy <elaidya225@gmail.com>
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
This commit is contained in:
Pavel Tikhomirov 2022-12-14 14:51:02 +03:00 committed by Alexander Mikhalitsyn
parent 8c9a5a2690
commit 8897a0fb25
4 changed files with 15 additions and 2 deletions

View file

@ -234,6 +234,7 @@ TST_NOFILE := \
scm07 \
scm08 \
scm09 \
scm10 \
aio00 \
aio01 \
fd \
@ -677,6 +678,7 @@ scm02: CFLAGS += -DSEND_BOTH
scm04: CFLAGS += -DSEPARATE
scm08: CFLAGS += -DSEND_ANOTHER_FD
scm09: CFLAGS += -DCLOSE_SENDER_FD
scm10: CFLAGS += -DCLOSE_SENDER_FD
mntns_link_remap: CFLAGS += -DZDTM_LINK_REMAP
mntns_shared_bind02: CFLAGS += -DSHARED_BIND02
mntns_root_bind02: CFLAGS += -DROOT_BIND02

View file

@ -108,12 +108,14 @@ next_msg:
return fdp ? *fdp : -4;
}
#define MSG "HELLO"
int main(int argc, char **argv)
{
int sk[2] = { -1, -1 }, p[2] = { -1, -1 }, rfd, ret = 1;
#define MSG "HELLO"
#ifndef CLOSE_SENDER_FD
char buf[8]; /* bigger than the MSG to check boundaries */
#endif
test_init(argc, argv);
@ -174,6 +176,11 @@ int main(int argc, char **argv)
/* we sent this side of socketpair */
close(p[1]);
#ifdef CLOSE_SENDER_FD
close(p[0]);
p[0] = -1;
#endif
test_daemon();
test_waitsig();
@ -183,6 +190,7 @@ int main(int argc, char **argv)
goto out;
}
#ifndef CLOSE_SENDER_FD
if (write(p[0], MSG, sizeof(MSG)) != sizeof(MSG)) {
fail("Socket write-broken");
goto out;
@ -198,6 +206,7 @@ int main(int argc, char **argv)
fail("Socket read-broken (%s)", buf);
goto out;
}
#endif
pass();
ret = 0;

1
test/zdtm/static/scm10.c Symbolic link
View file

@ -0,0 +1 @@
scm07.c

1
test/zdtm/static/scm10.desc Symbolic link
View file

@ -0,0 +1 @@
scm07.desc