[gnome-shell] Check the result of fgets() to deal with warn_unused_result



commit 59532ab0c738f28e74df1f0f885faf05a1bd187d
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Aug 6 17:59:20 2009 -0400

    Check the result of fgets() to deal with warn_unused_result
    
    Some C library versions have __attribute__((warn_unused_result)) on
    fgets(). We really don't care since we are just throwing the data
    away, but check the result anyways.

 src/shell-recorder.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/shell-recorder.c b/src/shell-recorder.c
index 2ff7d5a..70f833e 100644
--- a/src/shell-recorder.c
+++ b/src/shell-recorder.c
@@ -221,7 +221,8 @@ get_memory_target (void)
           return mem_total / 2;
         }
       /* Skip to the next line and discard what we read */
-      fgets(line_buffer, sizeof(line_buffer), f);
+      if (fgets(line_buffer, sizeof(line_buffer), f) == NULL)
+        break;
     }
 
   fclose(f);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]