aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-10-15 02:00:56 +0000
committerAlan Modra <amodra@gmail.com>2007-10-15 02:00:56 +0000
commit615f314969111779bdaffaef0e00d13a0efd51f5 (patch)
tree234eaa69ef30f097b5316983ade490b64de93841 /binutils/objdump.c
parent5375ec41bea0ede4ebb4ef8afdc5df82466b3db9 (diff)
downloadgdb-615f314969111779bdaffaef0e00d13a0efd51f5.zip
gdb-615f314969111779bdaffaef0e00d13a0efd51f5.tar.gz
gdb-615f314969111779bdaffaef0e00d13a0efd51f5.tar.bz2
* objdump.c (print_line): Check fwrite return value.
* srconv.c (checksum, wr_tr, wr_cs): Likewise. * sysdump.c (fillup): Return zero on getc or fread EOF. Return count read.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 03bc4d6..ee5530b 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1130,14 +1130,17 @@ static void
print_line (struct print_file_list *p, unsigned int line)
{
const char *l;
+ size_t len;
--line;
if (line >= p->maxline)
return;
l = p->linemap [line];
- fwrite (l, 1, strcspn (l, "\n\r"), stdout);
- putchar ('\n');
-}
+ /* Test fwrite return value to quiet glibc warning. */
+ len = strcspn (l, "\n\r");
+ if (len == 0 || fwrite (l, len, 1, stdout) == 1)
+ putchar ('\n');
+}
/* Print a range of source code lines. */