From d46735235be2b3bcaf2e580d86f321130cd78e94 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 5 Jul 1999 06:47:59 +0000 Subject: [PATCH] Rename full_read to safe_read. --- src/buffer.c | 2 +- src/create.c | 10 +++++----- src/rmt.c | 10 +++++----- src/rmt.h | 2 +- src/rtapelib.c | 8 ++++---- src/update.c | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 71843a4..bdb467c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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; } diff --git a/src/create.c b/src/create.c index ebc0442..a701c5a 100644 --- a/src/create.c +++ b/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]; diff --git a/src/rmt.c b/src/rmt.c index b0ec6f9..f5e036c 100644 --- a/src/rmt.c +++ b/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); diff --git a/src/rmt.h b/src/rmt.h index 7b3c298..b83f17e 100644 --- a/src/rmt.h +++ b/src/rmt.h @@ -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) \ diff --git a/src/rtapelib.c b/src/rtapelib.c index 0afdec9..937fd70 100644 --- a/src/rtapelib.c +++ b/src/rtapelib.c @@ -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) { diff --git a/src/update.c b/src/update.c index 98211ee..ea4dccf 100644 --- a/src/update.c +++ b/src/update.c @@ -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]; -- 2.44.0