more detailed errors
This commit is contained in:
parent
79c58aa87a
commit
ce61815bb2
1 changed files with 25 additions and 1 deletions
26
code/leak.c
26
code/leak.c
|
@ -52,7 +52,31 @@ main(void)
|
||||||
int ret;
|
int ret;
|
||||||
ret = pipe2(spray[i], O_NONBLOCK);
|
ret = pipe2(spray[i], O_NONBLOCK);
|
||||||
if (ret < 0) {
|
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);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ret = fcntl(spray[i][0], F_SETPIPE_SZ, 8192);
|
ret = fcntl(spray[i][0], F_SETPIPE_SZ, 8192);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue