more detailed errors

This commit is contained in:
twoneis 2025-04-25 09:32:44 +02:00
parent 79c58aa87a
commit ce61815bb2

View file

@ -52,7 +52,31 @@ main(void)
int ret;
ret = pipe2(spray[i], O_NONBLOCK);
if (ret < 0) {
printf("main: error: object %lu pipe2: %i\n", i, errno);
switch (errno) {
case EFAULT:
printf(
"main: error: object %lu pipe2: EFAULT\n",
i);
break;
case EINVAL:
printf(
"main: error: object %lu pipe2: EINVAL\n",
i);
break;
case EMFILE:
printf(
"main: error: object %lu pipe2: EMFILE\n",
i);
break;
case ENFILE:
printf(
"main: error: object %lu pipe2: ENFILE\n",
i);
break;
default:
printf("main: error: object %lu pipe2: %i\n", i,
errno);
}
exit(-1);
}
ret = fcntl(spray[i][0], F_SETPIPE_SZ, 8192);