2014-03-28 Richard Biener <rguenther@suse.de>
libiberty/ * simple-object.c (simple_object_internal_read): Handle EINTR and short reads. lto-plugin/ * lto-plugin.c (process_symtab): Handle EINTR and short reads. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208898 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
parent
201f096fea
commit
81ad11e32c
@ -1,3 +1,8 @@
|
|||||||
|
2014-03-28 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
* simple-object.c (simple_object_internal_read): Handle
|
||||||
|
EINTR and short reads.
|
||||||
|
|
||||||
2014-03-13 Uros Bizjak <ubizjak@gmail.com>
|
2014-03-13 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* regex.c (bzero) [!_LIBC]: Define without coma expression.
|
* regex.c (bzero) [!_LIBC]: Define without coma expression.
|
||||||
|
@ -63,8 +63,6 @@ simple_object_internal_read (int descriptor, off_t offset,
|
|||||||
unsigned char *buffer, size_t size,
|
unsigned char *buffer, size_t size,
|
||||||
const char **errmsg, int *err)
|
const char **errmsg, int *err)
|
||||||
{
|
{
|
||||||
ssize_t got;
|
|
||||||
|
|
||||||
if (lseek (descriptor, offset, SEEK_SET) < 0)
|
if (lseek (descriptor, offset, SEEK_SET) < 0)
|
||||||
{
|
{
|
||||||
*errmsg = "lseek";
|
*errmsg = "lseek";
|
||||||
@ -72,15 +70,26 @@ simple_object_internal_read (int descriptor, off_t offset,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
got = read (descriptor, buffer, size);
|
do
|
||||||
if (got < 0)
|
|
||||||
{
|
{
|
||||||
*errmsg = "read";
|
ssize_t got = read (descriptor, buffer, size);
|
||||||
*err = errno;
|
if (got == 0)
|
||||||
return 0;
|
break;
|
||||||
|
else if (got > 0)
|
||||||
|
{
|
||||||
|
buffer += got;
|
||||||
|
size -= got;
|
||||||
|
}
|
||||||
|
else if (errno != EINTR)
|
||||||
|
{
|
||||||
|
*errmsg = "read";
|
||||||
|
*err = errno;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
while (size > 0);
|
||||||
|
|
||||||
if ((size_t) got < size)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
*errmsg = "file too short";
|
*errmsg = "file too short";
|
||||||
*err = 0;
|
*err = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user