File pointer-comparison.diff of Package wavemon
Author: Lars Mueller <lmuelle at suse dot de>
Subject: ordered comparison of pointer with integer zero
Bugzilla: bnc 433389
Fixed upstream: no
Reported upstream: no
Index: wavemon-0.4.0b/conf.c
===================================================================
--- wavemon-0.4.0b.orig/conf.c
+++ wavemon-0.4.0b/conf.c
@@ -517,7 +517,7 @@ void write_cf()
}
}
- if ((fd = fopen(cfname, "w")) < 0) fatal_error("cannot open %s", cfname);
+ if ((fd = fopen(cfname, "w")) == NULL) fatal_error("cannot open %s", cfname);
ll_reset(cfld);
while ((lp = ll_getall(cfld))) fputs(lp, fd);
fclose(fd);
Index: wavemon-0.4.0b/iw_if.c
===================================================================
--- wavemon-0.4.0b.orig/iw_if.c
+++ wavemon-0.4.0b/iw_if.c
@@ -134,7 +134,7 @@ void low_signal()
* get console... no permissions? okay, take stdout
* instead and pray
*/
- if ((fd = open("/dev/console", O_WRONLY)) < 0) fd = 1;
+ if ((fd = open("/dev/console", O_WRONLY)) == NULL) fd = 1;
if (ioctl(fd, KIOCSOUND, 1491) >= 0) {
usleep(50000);
@@ -394,7 +394,7 @@ int iw_getstat(char *ifname, struct iw_s
static float avg_signal = 0, avg_noise = 0;
char *lp;
- if ((fd = fopen("/proc/net/wireless", "r")) < 0) fatal_error("cannot open /proc/net/wireless");
+ if ((fd = fopen("/proc/net/wireless", "r")) == NULL) fatal_error("cannot open /proc/net/wireless");
while (fgets(tmp, 0x100, fd)) {
lp = tmp + strspn(tmp, " ");
Index: wavemon-0.4.0b/net_if.c
===================================================================
--- wavemon-0.4.0b.orig/net_if.c
+++ wavemon-0.4.0b/net_if.c
@@ -61,7 +61,7 @@ void if_getstat(char *ifname, struct if_
unsigned long d;
char *lp;
- if ((fd = fopen("/proc/net/dev", "r")) < 0) {
+ if ((fd = fopen("/proc/net/dev", "r")) == NULL) {
fprintf(stderr, "fatal error: cannot open /proc/net/dev\n");
exit(-1);
}