summaryrefslogtreecommitdiff
path: root/iwinfo_utils.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-05-19 18:54:58 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-05-19 18:54:58 +0200
commite8a1e7d224918ba23fe0cd125e70907cb31aea31 (patch)
tree8a28b33406dc57ec736fb37c62f23178e15878f7 /iwinfo_utils.c
parent5aef442328121483ac0b7925c0422e92788c9e7b (diff)
downloadiwinfo-e8a1e7d224918ba23fe0cd125e70907cb31aea31.tar.gz
Fix -Wall -Wpedantic warnings
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'iwinfo_utils.c')
-rw-r--r--iwinfo_utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/iwinfo_utils.c b/iwinfo_utils.c
index 9654207..f4b7b58 100644
--- a/iwinfo_utils.c
+++ b/iwinfo_utils.c
@@ -177,15 +177,16 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
FILE *mtd;
uint16_t *bc;
- int fd, len, off;
+ int fd;
+ unsigned int len, off;
char buf[128];
if (!(mtd = fopen("/proc/mtd", "r")))
return -1;
- while (fgets(buf, sizeof(buf), mtd) > 0)
+ while (fgets(buf, sizeof(buf), mtd) != NULL)
{
- if (fscanf(mtd, "mtd%d: %x %*x %127s", &off, &len, buf) < 3 ||
+ if (fscanf(mtd, "mtd%u: %x %*x %127s", &off, &len, buf) < 3 ||
(strcmp(buf, "\"boardconfig\"") && strcmp(buf, "\"EEPROM\"") &&
strcmp(buf, "\"factory\"")))
{
@@ -246,7 +247,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
id->subsystem_vendor_id = 0x1814;
/* device */
- if (bc[off] & 0xf0 == 0x30)
+ if ((bc[off] & 0xf0) == 0x30)
id->device_id = (bc[off] >> 8) | (bc[off] & 0x00ff) << 8;
else
id->device_id = bc[off];