libqmi/0002-swi-update-close-the-file-handle-even-if-it-s-zero.patch
Lubomir Rintel ac8c0ebdf0 Add patches for a pair of bugs that make static analysis unhappy
Real bugs, but no security implications. Let's check the boxes and fix
them, to reduce the static analysis tooling noise.

Resolves: https://issues.redhat.com/browse/RHEL-38475
2024-06-25 10:39:47 +02:00

29 lines
800 B
Diff

From 489dde670fd2b5e6721876279dce03f3a4002d44 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 23 May 2024 10:46:56 +0200
Subject: [PATCH 2/9] swi-update: close the file handle even if it's zero
Technically, zero is a perfectly fine file descriptor for open() to
return in case the parent process feels frivolous and chooses to
close stdin.
---
utils/swi-update.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/swi-update.c b/utils/swi-update.c
index 609c5baa..61cd71c9 100644
--- a/utils/swi-update.c
+++ b/utils/swi-update.c
@@ -867,7 +867,7 @@ static int download_image(int serfd, char *buf, const char *image)
fprintf(stderr, "\n");
out:
- if (imgfd > 0)
+ if (imgfd >= 0)
close(imgfd);
return ret;
}
--
2.45.2