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 11:38:38 UTC 2018


Harald Welte has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/21/11421/1

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: newchange
Gerrit-Change-Id: Id7e62116bfee550ef9906e78a0fce6f28af27a97
Gerrit-Change-Number: 11421
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181021/f7b3990e/attachment.htm>


More information about the gerrit-log mailing list