* 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.
This commit is contained in:
parent
5375ec41be
commit
615f314969
4 changed files with 34 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-10-15 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* 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.
|
||||
|
||||
2007-10-10 Jim Blandy <jimb@codesourcery.com>
|
||||
|
||||
* dwarf.c (process_debug_info): Line up section offsets of
|
||||
|
|
|
@ -1130,12 +1130,15 @@ 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);
|
||||
/* Test fwrite return value to quiet glibc warning. */
|
||||
len = strcspn (l, "\n\r");
|
||||
if (len == 0 || fwrite (l, len, 1, stdout) == 1)
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -119,8 +119,15 @@ fillup (unsigned char *ptr)
|
|||
int sum;
|
||||
int i;
|
||||
|
||||
size = getc (file) - 2;
|
||||
fread (ptr, 1, size, file);
|
||||
size = getc (file);
|
||||
if (size == EOF
|
||||
|| size <= 2)
|
||||
return 0;
|
||||
|
||||
size -= 2;
|
||||
if (fread (ptr, size, 1, file) != 1)
|
||||
return 0;
|
||||
|
||||
sum = code + size + 2;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
|
@ -132,7 +139,7 @@ fillup (unsigned char *ptr)
|
|||
if (dump)
|
||||
dh (ptr, size);
|
||||
|
||||
return size - 1;
|
||||
return size;
|
||||
}
|
||||
|
||||
static barray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue