Rename full_read to safe_read.
This commit is contained in:
@@ -457,7 +457,7 @@ child_open_for_compress (void)
|
||||
|
||||
if (size < BLOCKSIZE)
|
||||
size = BLOCKSIZE;
|
||||
status = full_read (STDIN_FILENO, cursor, size);
|
||||
status = safe_read (STDIN_FILENO, cursor, size);
|
||||
if (status <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
10
src/create.c
10
src/create.c
@@ -540,7 +540,7 @@ deal_with_sparse (char *name, union block *header)
|
||||
init_sparsearray ();
|
||||
clear_buffer (buffer);
|
||||
|
||||
while (count = full_read (file, buffer, sizeof buffer), count != 0)
|
||||
while (count = safe_read (file, buffer, sizeof buffer), count != 0)
|
||||
{
|
||||
/* Realloc the scratch area as necessary. FIXME: should reallocate
|
||||
only at beginning of a new instance of non-zero data. */
|
||||
@@ -659,7 +659,7 @@ finish_sparse_file (int file, off_t *sizeleft, off_t fullsize, char *name)
|
||||
#if 0
|
||||
if (amount_read)
|
||||
{
|
||||
count = full_read (file, start->buffer + amount_read,
|
||||
count = safe_read (file, start->buffer + amount_read,
|
||||
BLOCKSIZE - amount_read);
|
||||
bufsize -= BLOCKSIZE - amount_read;
|
||||
amount_read = 0;
|
||||
@@ -670,7 +670,7 @@ finish_sparse_file (int file, off_t *sizeleft, off_t fullsize, char *name)
|
||||
#endif
|
||||
/* Store the data. */
|
||||
|
||||
count = full_read (file, start->buffer, BLOCKSIZE);
|
||||
count = safe_read (file, start->buffer, BLOCKSIZE);
|
||||
if (count < 0)
|
||||
{
|
||||
char buf[UINTMAX_STRSIZE_BOUND];
|
||||
@@ -691,7 +691,7 @@ Read error at byte %s, reading %lu bytes, in file %s"),
|
||||
char buffer[BLOCKSIZE];
|
||||
|
||||
clear_buffer (buffer);
|
||||
count = full_read (file, buffer, bufsize);
|
||||
count = safe_read (file, buffer, bufsize);
|
||||
memcpy (start->buffer, buffer, BLOCKSIZE);
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,7 @@ Removing leading `/' from absolute links")));
|
||||
if (f < 0)
|
||||
count = bufsize;
|
||||
else
|
||||
count = full_read (f, start->buffer, bufsize);
|
||||
count = safe_read (f, start->buffer, bufsize);
|
||||
if (count < 0)
|
||||
{
|
||||
char buf[UINTMAX_STRSIZE_BOUND];
|
||||
|
||||
10
src/rmt.c
10
src/rmt.c
@@ -128,7 +128,7 @@ get_string (char *string)
|
||||
|
||||
for (counter = 0; counter < STRING_SIZE; counter++)
|
||||
{
|
||||
if (full_read (STDIN_FILENO, string + counter, 1) != 1)
|
||||
if (safe_read (STDIN_FILENO, string + counter, 1) != 1)
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
if (string[counter] == '\n')
|
||||
@@ -210,7 +210,7 @@ main (int argc, char *const *argv)
|
||||
top:
|
||||
errno = 0; /* FIXME: errno should be read-only */
|
||||
status = 0;
|
||||
if (full_read (STDIN_FILENO, &command, 1) != 1)
|
||||
if (safe_read (STDIN_FILENO, &command, 1) != 1)
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
switch (command)
|
||||
@@ -330,8 +330,8 @@ top:
|
||||
prepare_record_buffer (size);
|
||||
for (counter = 0; counter < size; counter += status)
|
||||
{
|
||||
status = full_read (STDIN_FILENO, &record_buffer[counter],
|
||||
size - counter);
|
||||
status = safe_read (STDIN_FILENO, &record_buffer[counter],
|
||||
size - counter);
|
||||
if (status <= 0)
|
||||
{
|
||||
DEBUG (_("rmtd: Premature eof\n"));
|
||||
@@ -356,7 +356,7 @@ top:
|
||||
|
||||
size = atol (count_string);
|
||||
prepare_record_buffer (size);
|
||||
status = full_read (tape, record_buffer, size);
|
||||
status = safe_read (tape, record_buffer, size);
|
||||
if (status < 0)
|
||||
goto ioerror;
|
||||
sprintf (reply_buffer, "A%ld\n", status);
|
||||
|
||||
@@ -65,7 +65,7 @@ int rmt_ioctl__ PARAMS ((int, int, char *));
|
||||
|
||||
#define rmtread(Fd, Buffer, Length) \
|
||||
(_isrmt (Fd) ? rmt_read__ (Fd - __REM_BIAS, Buffer, Length) \
|
||||
: full_read (Fd, Buffer, Length))
|
||||
: safe_read (Fd, Buffer, Length))
|
||||
|
||||
#define rmtwrite(Fd, Buffer, Length) \
|
||||
(_isrmt (Fd) ? rmt_write__ (Fd - __REM_BIAS, Buffer, Length) \
|
||||
|
||||
@@ -144,7 +144,7 @@ get_status_string (int handle, char *command_buffer)
|
||||
counter < COMMAND_BUFFER_SIZE;
|
||||
counter++, cursor++)
|
||||
{
|
||||
if (full_read (READ_SIDE (handle), cursor, 1) != 1)
|
||||
if (safe_read (READ_SIDE (handle), cursor, 1) != 1)
|
||||
{
|
||||
_rmt_shutdown (handle, EIO);
|
||||
return 0;
|
||||
@@ -180,7 +180,7 @@ get_status_string (int handle, char *command_buffer)
|
||||
{
|
||||
char character;
|
||||
|
||||
while (full_read (READ_SIDE (handle), &character, 1) == 1)
|
||||
while (safe_read (READ_SIDE (handle), &character, 1) == 1)
|
||||
if (character == '\n')
|
||||
break;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ rmt_read__ (int handle, char *buffer, size_t length)
|
||||
|
||||
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
|
||||
{
|
||||
rlen = full_read (READ_SIDE (handle), buffer, status - counter);
|
||||
rlen = safe_read (READ_SIDE (handle), buffer, status - counter);
|
||||
if (rlen <= 0)
|
||||
{
|
||||
_rmt_shutdown (handle, EIO);
|
||||
@@ -661,7 +661,7 @@ rmt_ioctl__ (int handle, int operation, char *argument)
|
||||
|
||||
for (; status > 0; status -= counter, argument += counter)
|
||||
{
|
||||
counter = full_read (READ_SIDE (handle),
|
||||
counter = safe_read (READ_SIDE (handle),
|
||||
argument, (size_t) status);
|
||||
if (counter <= 0)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ append_file (char *path)
|
||||
(size_t) (BLOCKSIZE - status));
|
||||
}
|
||||
|
||||
status = full_read (handle, start->buffer, buffer_size);
|
||||
status = safe_read (handle, start->buffer, buffer_size);
|
||||
if (status < 0)
|
||||
{
|
||||
char buf[UINTMAX_STRSIZE_BOUND];
|
||||
|
||||
Reference in New Issue
Block a user