Remove several compiler warnings of the form wmifs.c:666:7: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(temp, BUFFER_SIZE, fp); ^ --- wmifs/wmifs/wmifs.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/wmifs/wmifs/wmifs.c b/wmifs/wmifs/wmifs.c index 1487878..c9be457 100644 --- a/wmifs/wmifs/wmifs.c +++ b/wmifs/wmifs/wmifs.c @@ -663,8 +663,14 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) /* Read from /proc/net/dev the stats! */ fp = fopen("/proc/net/dev", "r"); - fgets(temp, BUFFER_SIZE, fp); - fgets(temp, BUFFER_SIZE, fp); + if (!fgets(temp, BUFFER_SIZE, fp)) { + fclose(fp); + return -1; + } + if (!fgets(temp, BUFFER_SIZE, fp)) { + fclose(fp); + return -1; + } input = -1; output = -1; @@ -756,8 +762,14 @@ int checknetdevs(void) fd = fopen("/proc/net/dev", "r"); if (fd) { /* Skip the first 2 lines */ - fgets(temp, BUFFER_SIZE, fd); - fgets(temp, BUFFER_SIZE, fd); + if (!fgets(temp, BUFFER_SIZE, fd)) { + fclose(fd); + return -1; + } + if (!fgets(temp, BUFFER_SIZE, fd)) { + fclose(fd); + return -1; + } while (fgets(temp, BUFFER_SIZE, fd)) { p = strtok(temp, tokens); if (p == NULL) { -- 1.9.1 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.