2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

zdtm: check in-flight data in ttys

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Andrew Vagin
2016-05-12 21:21:46 +03:00
committed by Pavel Emelyanov
parent ebc3421df2
commit 8e778d29c6

View File

@@ -21,9 +21,9 @@ static void signal_handler_sighup(int signum)
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
int fdm, fds, ret, tty; int fdm, fds, ret, tty, i;
char *slavename; char *slavename;
char buf[10]; char buf[4096];
const char teststr[] = "hello\n"; const char teststr[] = "hello\n";
struct sigaction sa = { struct sigaction sa = {
@@ -77,21 +77,24 @@ int main(int argc, char ** argv)
close(fds); close(fds);
fds = 100; fds = 100;
test_daemon(); for (i = 0; i < 10; i++) {
/* Check connectivity */
test_waitsig(); ret = write(fdm, teststr, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
/* Check connectivity */ pr_perror("write(fdm) failed");
ret = write(fdm, teststr, sizeof(teststr) - 1); return 1;
if (ret != sizeof(teststr) - 1) { }
pr_perror("write(fdm) failed");
return 1;
} }
ret = read(fds, buf, sizeof(teststr) - 1); test_daemon();
if (ret != sizeof(teststr) - 1) { test_waitsig();
pr_perror("read(fds) failed");
return 1; for (i = 0; i < 10; i++) {
ret = read(fds, buf, sizeof(teststr) - 1);
if (ret != sizeof(teststr) - 1) {
pr_perror("read(fds) failed");
return 1;
}
} }
if (strncmp(teststr, buf, sizeof(teststr) - 1)) { if (strncmp(teststr, buf, sizeof(teststr) - 1)) {