[LEDE-DEV] [PATCH mountd 5/5] mountd: Fix unused result in mount.c for fgets()
Florian Fainelli
f.fainelli at gmail.com
Sun Mar 5 16:50:16 PST 2017
Fixes the following warning:
mountd-2016-12-19-dd5799c9/mount.c: In function 'mount_dev_get_property':
mountd-2016-12-19-dd5799c9/mount.c:454:3: error: 'model' undeclared (first use in this function)
model[strlen(prop_val) - 1] = '\0';
^
Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
mount.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mount.c b/mount.c
index fd5d073ca3eb..9607acdd8c5a 100644
--- a/mount.c
+++ b/mount.c
@@ -532,8 +532,10 @@ static void mount_dev_add(char *dev)
if(!fp)
snprintf(sector_size, 64, "unknown");
else {
- fgets(sector_size, 64, fp);
- sector_size[strlen(sector_size) - 1] = '\0';
+ if (!fgets(sector_size, 64, fp))
+ snprintf(sector_size, 64, "unknown");
+ else
+ sector_size[strlen(sector_size) - 1] = '\0';
fclose(fp);
}
snprintf(tmp, 64, "/dev/%s", dev);
--
2.9.3
More information about the Lede-dev
mailing list