Change in osmo-bsc[master]: ipaccess-config: Fix open() return value checking

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Oct 21 12:19:36 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11421 )

Change subject: ipaccess-config: Fix open() return value checking
......................................................................

ipaccess-config: Fix open() return value checking

open() returning 0 is valid, but negative values indicate errors.

Change-Id: Id7e62116bfee550ef9906e78a0fce6f28af27a97
Fixes: Coverity CID#57865
---
M src/ipaccess/ipaccess-config.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 079bae2..5491700 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -634,7 +634,7 @@
 	INIT_LLIST_HEAD(entry);
 
 	fd = open(filename, O_RDONLY);
-	if (!fd) {
+	if (fd < 0) {
 		perror("nada");
 		return -1;
 	}
@@ -729,7 +729,7 @@
 
 	printf("Opening possible firmware '%s'\n", filename);
 	fd = open(filename, O_RDONLY);
-	if (!fd) {
+	if (fd < 0) {
 		perror("nada");
 		return;
 	}

-- 
To view, visit https://gerrit.osmocom.org/11421
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id7e62116bfee550ef9906e78a0fce6f28af27a97
Gerrit-Change-Number: 11421
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/59b76679/attachment.htm>


More information about the gerrit-log mailing list