From ce61815bb203a1ada38ce567c7b0d3ce7bd58361 Mon Sep 17 00:00:00 2001 From: twoneis Date: Fri, 25 Apr 2025 09:32:44 +0200 Subject: [PATCH] more detailed errors --- code/leak.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/code/leak.c b/code/leak.c index 27f63ef5b..afee48220 100644 --- a/code/leak.c +++ b/code/leak.c @@ -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);