add exit on error

This commit is contained in:
twoneis 2025-04-25 09:17:44 +02:00
parent 56d0721fa8
commit 176eb30d1c

View file

@ -52,14 +52,17 @@ main(void)
ret = pipe2(spray[i], O_NONBLOCK); ret = pipe2(spray[i], O_NONBLOCK);
if (ret < 0) { if (ret < 0) {
printf("main: error: pipe2: object %lu\n", i); printf("main: error: pipe2: object %lu\n", i);
exit(-1);
} }
ret = fcntl(spray[i][0], F_SETPIPE_SZ, 2 << 12); ret = fcntl(spray[i][0], F_SETPIPE_SZ, 2 << 12);
if (ret < 0) { if (ret < 0) {
printf("main: error: fcntl: object %lu\n", i); printf("main: error: fcntl: object %lu\n", i);
exit(-1);
} }
ret = write(spray[i][1], buffer, 8); ret = write(spray[i][1], buffer, 8);
if (ret < 0) { if (ret < 0) {
printf("main: error: write: object %lu\n", i); printf("main: error: write: object %lu\n", i);
exit(-1);
} }
} }