2008-08-20 Craig Silverstein <csilvers@google.com>
[deliverable/binutils-gdb.git] / binutils / srconv.c
index 840333963fb9b19335e5ce99fc3bc07aed6a6515..2a7d63876a31e286887818a45e3efa5ca8a1f175 100644 (file)
@@ -6,7 +6,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -26,6 +26,7 @@
 
    All debugging information is preserved */
 
+#include "sysdep.h"
 #include "bfd.h"
 #include "bucomm.h"
 #include "sysroff.h"
@@ -45,7 +46,7 @@ static char **rnames;
 static int get_member_id (int);
 static int get_ordinary_id (int);
 static char *section_translate (char *);
-static char *strip_suffix (char *);
+static char *strip_suffix (const char *);
 static void checksum (FILE *, unsigned char *, int, int);
 static void writeINT (int, unsigned char *, int *, int, FILE *);
 static void writeBITS (int, unsigned char *, int *, int);
@@ -141,9 +142,8 @@ section_translate (char *n)
 
 #define DATE "940201073000";   /* Just a time on my birthday */
 
-static
-char *
-strip_suffix (char *name)
+static char *
+strip_suffix (const char *name)
 {
   int i;
   char *res;
@@ -176,7 +176,9 @@ checksum (FILE *file, unsigned char *ptr, int size, int code)
 
   /* Glue on a checksum too.  */
   ptr[bytes] = ~sum;
-  fwrite (ptr, bytes + 1, 1, file);
+  if (fwrite (ptr, bytes + 1, 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 
@@ -299,7 +301,10 @@ wr_tr (void)
       0x03,                    /* RL */
       0xfd,                    /* CS */
     };
-  fwrite (b, 1, sizeof (b), file);
+
+  if (fwrite (b, sizeof (b), 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 static void
@@ -1452,7 +1457,10 @@ wr_cs (void)
     0x00,                      /* dot */
     0xDE                       /* CS */
   };
-  fwrite (b, 1, sizeof (b), file);
+
+  if (fwrite (b, sizeof (b), 1, file) != 1)
+    /* FIXME: Return error status.  */
+    abort ();
 }
 
 /* Write out the SC records for a unit.  Create an SC
This page took 0.028077 seconds and 4 git commands to generate.