[gobject-introspection/ebassi/issue-414: 5/5] cmph: Handle fgets() return value




commit c5038e542fe9abf878da13812f229372b5fdcf92
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jan 11 15:59:43 2022 +0000

    cmph: Handle fgets() return value
    
    Newer versions of the GNU libc have started to warn if the result of the
    call is unused.

 girepository/cmph/cmph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/girepository/cmph/cmph.c b/girepository/cmph/cmph.c
index 0c4b67d1..3fd40a29 100644
--- a/girepository/cmph/cmph.c
+++ b/girepository/cmph/cmph.c
@@ -155,7 +155,7 @@ static cmph_uint32 count_nlfile_keys(FILE *fd)
        while(1)
        {
                char buf[BUFSIZ];
-               fgets(buf, BUFSIZ, fd); 
+               if (fgets(buf, BUFSIZ, fd) == NULL) break;
                if (feof(fd)) break;
                if (buf[strlen(buf) - 1] != '\n') continue;
                ++count;


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