2008-01-10 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / binutils / objdump.c
index 8ab69a44f6f5f1714860930261d9ad0b3876e43b..5a2ea6ddf3703cc9421fd3a4f4bd16cdd54ad486 100644 (file)
@@ -171,6 +171,8 @@ static bfd_size_type stab_size;
 
 static char *strtab;
 static bfd_size_type stabstr_size;
+
+static bfd_boolean is_relocatable = FALSE;
 \f
 static void
 usage (FILE *stream, int status)
@@ -1130,14 +1132,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. */
 
@@ -2166,8 +2171,7 @@ check_mach_o_dwarf (bfd *abfd)
 static void
 dump_dwarf (bfd *abfd)
 {
-  is_relocatable = ((abfd->flags & (HAS_RELOC | EXEC_P | DYNAMIC))
-                   == HAS_RELOC);
+  is_relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
 
   /* FIXME: bfd_get_arch_size may return -1.  We assume that 64bit
      targets will return 64.  */
This page took 0.023389 seconds and 4 git commands to generate.