commit 1a07419e1f524f91150dc146a2c13fcf3b0bd638
parent de7198ec54f6d63fdb994a0cb140dff8d5208192
Author: Naveen Narayanan <zerous@nocebo.space>
Date: Sun, 10 Oct 2021 13:37:32 +0200
Check if fdopen returns error
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -95,7 +95,13 @@ foverlap(int fd1, int fd2)
char buf1[16], buf2[16];
fp1 = fdopen(fd1, "r");
+ if (!fp1)
+ err(1, "fdopen failed");
+
fp2 = fdopen(fd2, "r");
+ if (!fp2)
+ err(1, "fdopen failed");
+
do {
r1 = fscanf(fp1, "%s\n", buf1);
if (r1 != EOF) {