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

[Xen-changelog] [xen master] symbols.c: avoid warn_unused_result build failure on fgets()



commit 85ad62ecb8c2b31bf13b5e88696ec1d42c7031e4
Author:     Riku Voipio <riku.voipio@xxxxxxxxxx>
AuthorDate: Tue Nov 10 12:07:55 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Nov 10 12:07:55 2015 +0100

    symbols.c: avoid warn_unused_result build failure on fgets()
    
    In commit:
    
    d37d63d symbols: prefix static symbols with their source file names
    
    An unchecked fgets was added. This causes a compile error at least
    on ubuntu utopic:
    
    symbols.c: In function 'read_symbol':
    symbols.c:181:3: error: ignoring return value of 'fgets', declared with
    attribute warn_unused_result [-Werror=unused-result]
       fgets(str, 500, in); /* discard rest of line */
       ^
    
    Paper over the warning by checking the return value in the if statement.
    
    Signed-off-by: Riku Voipio <riku.voipio@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/tools/symbols.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index dbf6a1a..1abdf08 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -177,8 +177,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
        rc = 0;
 
  skip_tail:
-       if (input_format == fmt_sysv)
-               fgets(str, 500, in); /* discard rest of line */
+       if ((input_format == fmt_sysv) && fgets(str, 500, in) == NULL)
+               /* ignore errors while discarding rest of line */;
 
        return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.