Adjust better to Gnulib signed-int read changes

The 2024-08-09 Gnulib changes that caused some modules prefer
signed types to size_t means that Tar should follow suit.
* src/buffer.c (short_read):
* src/system.c (sys_child_open_for_compress)
(sys_child_open_for_uncompress):
rmtread and safe_read return ptrdiff_t not idx_t;
don’t rely on implementation defined conversion.
* src/misc.c (blocking_read): Never return a negative number.
Return idx_t, not ptrdiff_t, with the same convention for EOF
and error as the new full_read.  All callers changed.
* src/sparse.c (sparse_dump_region, check_sparse_region)
(check_data_region):
* src/update.c (append_file):
full_read no longer returns SAFE_READ_ERROR for I/O error; instead it
returns the number of bytes successfully read, and sets errno.
Adjust to this.
* src/system.c (sys_child_open_for_uncompress):
Rewrite to avoid need for goto and label.
This commit is contained in:
Paul Eggert
2024-11-01 09:40:36 -07:00
parent e513950080
commit 7c0feaefd0
8 changed files with 87 additions and 134 deletions

View File

@@ -731,7 +731,7 @@ void undo_last_backup (void);
int deref_stat (char const *name, struct stat *buf);
ptrdiff_t blocking_read (int fd, void *buf, idx_t count);
idx_t blocking_read (int fd, void *buf, idx_t count);
idx_t blocking_write (int fd, void const *buf, idx_t count);
extern idx_t chdir_current;