]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
all-io: rename read_all/write_all to ul_read_all/ul_write_all
authorKarel Zak <kzak@redhat.com>
Tue, 30 Jun 2026 11:27:59 +0000 (13:27 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 9 Jul 2026 10:18:04 +0000 (12:18 +0200)
Add ul_ namespace prefix to all helper functions in all-io.h:

  write_all()      → ul_write_all()
  read_all()       → ul_read_all()
  read_all_alloc() → ul_read_all_alloc()
  fwrite_all()     → ul_fwrite_all()
  sendfile_all()   → ul_sendfile_all()

This is a mechanical rename with no logic changes, preparing
for the VFS I/O abstraction layer.

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
42 files changed:
agetty-cmd/agetty.c
agetty-cmd/issuefile.c
agetty-cmd/tty.c
disk-utils/fdisk.c
disk-utils/fsck.minix.c
disk-utils/mkfs.minix.c
disk-utils/mkswap.c
disk-utils/sfdisk.c
disk-utils/swaplabel.c
include/all-io.h
lib/blkdev.c
lib/env.c
lib/fileeq.c
lib/fileutils.c
lib/path.c
lib/plymouth-ctrl.c
lib/procfs.c
lib/pty-session.c
lib/sysfs.c
libblkid/src/probe.c
libfdisk/src/bsd.c
libfdisk/src/gpt.c
libfdisk/src/script.c
libfdisk/src/sgi.c
libfdisk/src/sun.c
libmount/src/hook_idmap.c
libuuid/src/gen_uuid.c
login-utils/last.c
misc-utils/enosys.c
misc-utils/lsclocks.c
misc-utils/mcookie.c
misc-utils/uuidd.c
misc-utils/wipefs.c
sys-utils/ldattach.c
sys-utils/lscpu-virt.c
sys-utils/nsenter.c
sys-utils/rfkill.c
sys-utils/setpriv.c
sys-utils/unshare.c
term-utils/script.c
term-utils/setterm.c
text-utils/pg.c

index 8974a9af7420c33dd2d18d577108b5291bc8f489..541d03e193e72c31582fbf74dc5ef577a7e587bf 100644 (file)
@@ -513,7 +513,7 @@ int main(int argc, char **argv)
        if (options.flags & F_INITSTRING &&
            options.initstring && *options.initstring != '\0') {
                debug("writing init string\n");
-               write_all(STDOUT_FILENO, options.initstring,
+               ul_write_all(STDOUT_FILENO, options.initstring,
                           strlen(options.initstring));
        }
 
@@ -601,7 +601,7 @@ int main(int argc, char **argv)
                agetty_reset_vc(&options, &termios, 1);
 
        /* Now the newline character should be properly written. */
-       write_all(STDOUT_FILENO, "\r\n", 2);
+       ul_write_all(STDOUT_FILENO, "\r\n", 2);
 
        sigaction(SIGQUIT, &sa_quit, NULL);
        sigaction(SIGINT, &sa_int, NULL);
@@ -745,8 +745,8 @@ again:
                                        cn = res->ai_canonname;
                        }
 
-                       write_all(STDOUT_FILENO, cn, strlen(cn));
-                       write_all(STDOUT_FILENO, " ", 1);
+                       ul_write_all(STDOUT_FILENO, cn, strlen(cn));
+                       ul_write_all(STDOUT_FILENO, " ", 1);
 
                        if (res)
                                freeaddrinfo(res);
@@ -755,7 +755,7 @@ again:
        }
        if (!op->autolog) {
                /* Always show login prompt. */
-               write_all(STDOUT_FILENO, LOGIN_PROMPT,
+               ul_write_all(STDOUT_FILENO, LOGIN_PROMPT,
                                sizeof(LOGIN_PROMPT) - 1);
        }
 }
@@ -924,7 +924,7 @@ static char *get_logname(struct agetty_issue *ie, struct agetty_options *op, str
                                                /* Ideally it should be "\xe2\x90\x9b"
                                                 * if (op->flags & (F_UTF8)),
                                                 * but only some fonts contain it */
-                                               write_all(1, "^[", 2);
+                                               ul_write_all(1, "^[", 2);
                                                *visual_bp = 2;         /* ESC shows as ^[ (2 chars) */
                                        } else if (ascval == '\t') {
                                                /* Tab expands to spaces */
@@ -932,10 +932,10 @@ static char *get_logname(struct agetty_issue *ie, struct agetty_options *op, str
                                                int spaces = 8 - (pos % 8);
                                                int i;
                                                for (i = 0; i < spaces; i++)
-                                                       write_all(1, " ", 1);
+                                                       ul_write_all(1, " ", 1);
                                                *visual_bp = spaces;
                                        } else {
-                                               write_all(1, &c, 1);    /* echo the character */
+                                               ul_write_all(1, &c, 1); /* echo the character */
                                                *visual_bp = 1;         /* normal char shows as 1 */
                                        }
                                } else {
index c314f39032aa6b05406d4f509ae90ee45756b34b..104ccef81428aa6b9de8ca59ee93843b1566e000 100644 (file)
@@ -69,7 +69,7 @@ static char *read_os_release(struct agetty_options *op, const char *varname)
                op->osrelease = malloc(st.st_size + 1);
                if (!op->osrelease)
                        agetty_log_err(_("failed to allocate memory: %m"));
-               if (read_all(fd, op->osrelease, st.st_size) != (ssize_t) st.st_size) {
+               if (ul_read_all(fd, op->osrelease, st.st_size) != (ssize_t) st.st_size) {
                        free(op->osrelease);
                        op->osrelease = NULL;
                        goto done;
@@ -210,7 +210,7 @@ void agetty_print_issue_file(struct agetty_issue *ie __attribute__((__unused__))
 {
        if ((op->flags & F_NONL) == 0) {
                /* Issue not in use, start with a new line. */
-               write_all(STDOUT_FILENO, "\r\n", 2);
+               ul_write_all(STDOUT_FILENO, "\r\n", 2);
        }
 }
 
@@ -292,7 +292,7 @@ void agetty_print_issue_file(struct agetty_issue *ie,
 
        if ((op->flags & F_NONL) == 0) {
                /* Issue not in use, start with a new line. */
-               write_all(STDOUT_FILENO, "\r\n", 2);
+               ul_write_all(STDOUT_FILENO, "\r\n", 2);
        }
 
        if (ie->do_tcsetattr) {
@@ -304,7 +304,7 @@ void agetty_print_issue_file(struct agetty_issue *ie,
        }
 
        if (ie->mem_sz && ie->mem)
-               write_all(STDOUT_FILENO, ie->mem, ie->mem_sz);
+               ul_write_all(STDOUT_FILENO, ie->mem, ie->mem_sz);
 
        if (ie->do_tcrestore) {
                /* Restore settings. */
@@ -446,7 +446,7 @@ void agetty_show_issue(struct agetty_options *op)
        agetty_eval_issue_file(&ie, op, &tp);
 
        if (ie.mem_sz)
-               write_all(STDOUT_FILENO, ie.mem, ie.mem_sz);
+               ul_write_all(STDOUT_FILENO, ie.mem, ie.mem_sz);
        if (ie.output)
                fclose(ie.output);
        free(ie.mem);
index c60430d247e03fb168d5920e3284bdf0cb156be4..e56e5f1bbbd9b82ef2763d3f45f069dfb9f1fd59 100644 (file)
@@ -168,7 +168,7 @@ void agetty_termio_clear(int fd)
         * erase everything below the cursor (ESC [ J), and set the
         * scrolling region to the full window (ESC [ r)
         */
-       write_all(fd, "\033[r\033[H\033[J", 9);
+       ul_write_all(fd, "\033[r\033[H\033[J", 9);
 }
 
 void agetty_reset_vc(const struct agetty_options *op, struct termios *tp, int canon)
@@ -685,5 +685,5 @@ void agetty_erase_char(int visual_count, struct chardata *cp)
        };
        int i;
        for (i = 0; i < visual_count; i++)
-               write_all(1, erase[cp->parity], 3);
+               ul_write_all(1, erase[cp->parity], 3);
 }
index 30481544a6cf2a5245d91c0787b799d3193fbfa9..02ffb964aea0bc5e98b3f93c565861f7a9f65f49 100644 (file)
@@ -1006,7 +1006,7 @@ static void dump_blkdev(struct fdisk_context *cxt, const char *name,
        else {
                unsigned char *buf = xmalloc(size);
 
-               if (read_all(fd, (char *) buf, size) != (ssize_t) size)
+               if (ul_read_all(fd, (char *) buf, size) != (ssize_t) size)
                        fdisk_warn(cxt, _("cannot read"));
                else
                        dump_buffer(offset, buf, size);
index 304b25cb48bac2e8943cbfbb2bebea6025a548d9..0dc814f58b990f03c1a4726071f4b97c902c5ae7 100644 (file)
@@ -526,13 +526,13 @@ write_tables(void) {
 
        write_super_block();
 
-       if (write_all(device_fd, inode_map, imaps * MINIX_BLOCK_SIZE))
+       if (ul_write_all(device_fd, inode_map, imaps * MINIX_BLOCK_SIZE))
                die(_("Unable to write inode map"));
 
-       if (write_all(device_fd, zone_map, zmaps * MINIX_BLOCK_SIZE))
+       if (ul_write_all(device_fd, zone_map, zmaps * MINIX_BLOCK_SIZE))
                die(_("Unable to write zone map"));
 
-       if (write_all(device_fd, inode_buffer, buffsz))
+       if (ul_write_all(device_fd, inode_buffer, buffsz))
                die(_("Unable to write inodes"));
 }
 
index 6a9c7ba81dba30487646817e522ca1ce0eeeb3ce..4e69712fd02e40aa19a36d9d34d4ce1fe7cc55b6 100644 (file)
@@ -196,21 +196,21 @@ static void write_tables(const struct fs_control *ctl)
        if (lseek(ctl->device_fd, 0, SEEK_SET))
                err(MKFS_EX_ERROR, _("%s: seek to boot block failed "
                                   "in write_tables"), ctl->device_name);
-       if (write_all(ctl->device_fd, boot_block_buffer, 512))
+       if (ul_write_all(ctl->device_fd, boot_block_buffer, 512))
                err(MKFS_EX_ERROR, _("%s: unable to clear boot sector"), ctl->device_name);
        if (MINIX_BLOCK_SIZE != lseek(ctl->device_fd, MINIX_BLOCK_SIZE, SEEK_SET))
                err(MKFS_EX_ERROR, _("%s: seek failed in write_tables"), ctl->device_name);
 
-       if (write_all(ctl->device_fd, super_block_buffer, MINIX_BLOCK_SIZE))
+       if (ul_write_all(ctl->device_fd, super_block_buffer, MINIX_BLOCK_SIZE))
                err(MKFS_EX_ERROR, _("%s: unable to write super-block"), ctl->device_name);
 
-       if (write_all(ctl->device_fd, inode_map, imaps * MINIX_BLOCK_SIZE))
+       if (ul_write_all(ctl->device_fd, inode_map, imaps * MINIX_BLOCK_SIZE))
                err(MKFS_EX_ERROR, _("%s: unable to write inode map"), ctl->device_name);
 
-       if (write_all(ctl->device_fd, zone_map, zmaps * MINIX_BLOCK_SIZE))
+       if (ul_write_all(ctl->device_fd, zone_map, zmaps * MINIX_BLOCK_SIZE))
                err(MKFS_EX_ERROR, _("%s: unable to write zone map"), ctl->device_name);
 
-       if (write_all(ctl->device_fd, inode_buffer, buffsz))
+       if (ul_write_all(ctl->device_fd, inode_buffer, buffsz))
                err(MKFS_EX_ERROR, _("%s: unable to write inodes"), ctl->device_name);
 }
 
@@ -219,7 +219,7 @@ static void write_block(const struct fs_control *ctl, int blk, char * buffer)
        if (blk * MINIX_BLOCK_SIZE != lseek(ctl->device_fd, blk * MINIX_BLOCK_SIZE, SEEK_SET))
                errx(MKFS_EX_ERROR, _("%s: seek failed in write_block"), ctl->device_name);
 
-       if (write_all(ctl->device_fd, buffer, MINIX_BLOCK_SIZE))
+       if (ul_write_all(ctl->device_fd, buffer, MINIX_BLOCK_SIZE))
                errx(MKFS_EX_ERROR, _("%s: write failed in write_block"), ctl->device_name);
 }
 
index d220d8f8ce61248c596afe2e097806cca105d1bc..a820a8815ca02aeb579c01832674f71a88c9860d 100644 (file)
@@ -492,7 +492,7 @@ static void wipe_device(struct mkswap_control *ctl)
                if (lseek(ctl->fd, 0, SEEK_SET) != 0)
                        errx(EXIT_FAILURE, _("unable to rewind swap-device"));
 
-               if (write_all(ctl->fd, buf, sizeof(buf)))
+               if (ul_write_all(ctl->fd, buf, sizeof(buf)))
                        errx(EXIT_FAILURE, _("unable to erase bootbits sectors"));
 #ifdef HAVE_LIBBLKID
                /*
@@ -544,7 +544,7 @@ static void write_header_to_device(struct mkswap_control *ctl)
        if (lseek(ctl->fd, offset, SEEK_SET) != offset)
                errx(EXIT_FAILURE, _("unable to rewind swap-device"));
 
-       if (write_all(ctl->fd, (char *) ctl->signature_page + SIGNATURE_OFFSET,
+       if (ul_write_all(ctl->fd, (char *) ctl->signature_page + SIGNATURE_OFFSET,
                      ctl->pagesize - SIGNATURE_OFFSET) == -1)
                err(EXIT_FAILURE,
                        _("%s: unable to write signature page"),
index c4037efff858dcc87d89325d31503da4832e2d8e..431b87aed03e63b4a4f4370427899990a3963b91 100644 (file)
@@ -305,12 +305,12 @@ static void backup_sectors(struct sfdisk *sf,
        } else {
                unsigned char *buf = xmalloc(size);
 
-               if (read_all(devfd, (char *) buf, size) != (ssize_t) size) {
+               if (ul_read_all(devfd, (char *) buf, size) != (ssize_t) size) {
                        fdisk_warn(sf->cxt, _("cannot read %s"), devname);
                        free(buf);
                        goto fail;
                }
-               if (write_all(fd, buf, size) != 0) {
+               if (ul_write_all(fd, buf, size) != 0) {
                        fdisk_warn(sf->cxt, _("cannot write %s"), fname);
                        free(buf);
                        goto fail;
@@ -548,7 +548,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa
                if (!sf->noact) {
                        /* read source */
                        if (lseek(fd, src, SEEK_SET) == (off_t) -1 ||
-                           read_all(fd, buf, step_bytes) != (ssize_t) step_bytes) {
+                           ul_read_all(fd, buf, step_bytes) != (ssize_t) step_bytes) {
                                if (f)
                                        fprintf(f, "%05zu: read error %12ju %12ju\n", cc, src, dst);
                                fdisk_warn(sf->cxt,
@@ -559,7 +559,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa
 
                        /* write target */
                        if (lseek(fd, dst, SEEK_SET) == (off_t) -1 ||
-                           write_all(fd, buf, step_bytes) != 0) {
+                           ul_write_all(fd, buf, step_bytes) != 0) {
                                if (f)
                                        fprintf(f, "%05zu: write error %12ju %12ju\n", cc, src, dst);
                                fdisk_warn(sf->cxt,
index 29484ffe569ec3c4ec13acb88577b8b7cf252463..37cf5d5b1985a7510ad9c952897ef253231e80f7 100644 (file)
@@ -79,7 +79,7 @@ static int change_info(const char *devname, const char *label,
                                warn(_("%s: failed to seek to swap UUID"), devname);
                                goto err;
 
-                       } else if (write_all(fd, newuuid, sizeof(newuuid))) {
+                       } else if (ul_write_all(fd, newuuid, sizeof(newuuid))) {
                                warn(_("%s: failed to write UUID"), devname);
                                goto err;
                        }
@@ -100,7 +100,7 @@ static int change_info(const char *devname, const char *label,
                if (strlen(label) > strlen(newlabel))
                        warnx(_("label is too long. Truncating it to '%s'"),
                                        newlabel);
-               if (write_all(fd, newlabel, sizeof(newlabel))) {
+               if (ul_write_all(fd, newlabel, sizeof(newlabel))) {
                        warn(_("%s: failed to write label"), devname);
                        goto err;
                }
index 65eae6025a7b2dd85ad6297b14e4e50c75179d5c..f83688c0a8d5dfc2680ff2333cefc95360292723 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "c.h"
 
-static inline int write_all(int fd, const void *buf, size_t count)
+static inline int ul_write_all(int fd, const void *buf, size_t count)
 {
        while (count) {
                ssize_t tmp;
@@ -38,7 +38,7 @@ static inline int write_all(int fd, const void *buf, size_t count)
        return 0;
 }
 
-static inline int fwrite_all(const void *ptr, size_t size,
+static inline int ul_fwrite_all(const void *ptr, size_t size,
                             size_t nmemb, FILE *stream)
 {
        while (nmemb) {
@@ -58,7 +58,7 @@ static inline int fwrite_all(const void *ptr, size_t size,
        return 0;
 }
 
-static inline ssize_t read_all(int fd, char *buf, size_t count)
+static inline ssize_t ul_read_all(int fd, char *buf, size_t count)
 {
        ssize_t ret;
        ssize_t c = 0;
@@ -84,7 +84,7 @@ static inline ssize_t read_all(int fd, char *buf, size_t count)
        return c;
 }
 
-static inline ssize_t read_all_alloc(int fd, char **buf)
+static inline ssize_t ul_read_all_alloc(int fd, char **buf)
 {
        size_t size = 1024, c = 0;
        ssize_t ret;
@@ -94,7 +94,7 @@ static inline ssize_t read_all_alloc(int fd, char **buf)
                return -1;
 
        while (1) {
-               ret = read_all(fd, *buf + c, size - c);
+               ret = ul_read_all(fd, *buf + c, size - c);
                if (ret < 0) {
                        free(*buf);
                        *buf = NULL;
@@ -114,7 +114,7 @@ static inline ssize_t read_all_alloc(int fd, char **buf)
        }
 }
 
-static inline ssize_t sendfile_all(int out __attribute__((__unused__)),
+static inline ssize_t ul_sendfile_all(int out __attribute__((__unused__)),
                                   int in __attribute__((__unused__)),
                                   off_t *off __attribute__((__unused__)),
                                   size_t count __attribute__((__unused__)))
index b3b343441f7a3456660d6bb3922e1c4679a9086c..cd40c41e8fe2989ad04ca3149703f94723fb2f62 100644 (file)
@@ -46,7 +46,7 @@ blkdev_valid_offset (int fd, off_t offset) {
 
        if (lseek (fd, offset, 0) < 0)
                return 0;
-       if (read_all (fd, &ch, 1) < 1)
+       if (ul_read_all (fd, &ch, 1) < 1)
                return 0;
        return 1;
 }
index e459959e0782929870547574d99c79f5b51820a1..2ea46254b5cac8c087c720b72159b99786e41130 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -173,7 +173,7 @@ struct ul_env_list *env_list_from_fd(int fd)
        struct ul_env_list *ls = NULL;
 
        errno = 0;
-       if ((rc = read_all_alloc(fd, &buf)) < 1)
+       if ((rc = ul_read_all_alloc(fd, &buf)) < 1)
                return NULL;
        buf[rc] = '\0';
        p = buf;
index 92c0c2c4b423ed64baae9d8a2ac3a0bda8830e42..4717bcfcf05180c3e8fb0c2802632344dba4a239 100644 (file)
@@ -394,7 +394,7 @@ static ssize_t read_block(struct ul_fileeq *eq, struct ul_fileeq_data *data,
        if (!*block)
                return -ENOMEM;
 
-       rsz = read_all(data->fd, (char *) *block, eq->readsiz);
+       rsz = ul_read_all(data->fd, (char *) *block, eq->readsiz);
        if (rsz < 0) {
                DBG_OBJ(DATA, data, ul_debug("  read failed"));
                return rsz;
@@ -462,7 +462,7 @@ static ssize_t get_digest(struct ul_fileeq *eq, struct ul_fileeq_data *data,
 
        /* get block digest (note 1st block is data->intro) */
        *block = data->blocks + (n * eq->method->digsiz);
-       rsz = read_all(eq->fd_cip, (char *) *block, sz);
+       rsz = ul_read_all(eq->fd_cip, (char *) *block, sz);
 
        if (rsz > 0)
                data->nblocks++;
@@ -484,7 +484,7 @@ static ssize_t get_intro(struct ul_fileeq *eq, struct ul_fileeq_data *data,
 
                if (fd < 0)
                        return -1;
-               rsz = read_all(fd, (char *) data->intro, sizeof(data->intro));
+               rsz = ul_read_all(fd, (char *) data->intro, sizeof(data->intro));
                DBG_OBJ(DATA, data, ul_debug(" read %zd bytes [%zu wanted] intro", rsz, sizeof(data->intro)));
                if (rsz < 0)
                        return -1;
index 447a342e7012f9cbad0c5681d8d2ce13adb1e6a4..8ae02efd5abb170fc942396588fa5e403aecaf48 100644 (file)
@@ -221,9 +221,9 @@ char *ul_restricted_path_oper(const char *path,
                          errno ? -errno : -EINVAL;
 
                /* send length or errno */
-               write_all(pipes[1], (char *) &len, sizeof(len));
+               ul_write_all(pipes[1], (char *) &len, sizeof(len));
                if (result)
-                       write_all(pipes[1], result, len);
+                       ul_write_all(pipes[1], result, len);
                _exit(0);
        default:
                break;
@@ -233,7 +233,7 @@ char *ul_restricted_path_oper(const char *path,
        pipes[1] = -1;
 
        /* read size or -errno */
-       if (read_all(pipes[0], (char *) &len, sizeof(len)) != sizeof(len))
+       if (ul_read_all(pipes[0], (char *) &len, sizeof(len)) != sizeof(len))
                goto done;
        if (len < 0) {
                errsv = -len;
@@ -246,7 +246,7 @@ char *ul_restricted_path_oper(const char *path,
                goto done;
        }
        /* read path */
-       if (read_all(pipes[0], result, len) != len) {
+       if (ul_read_all(pipes[0], result, len) != len) {
                errsv = errno;
                goto done;
        }
@@ -355,8 +355,8 @@ static int copy_file_simple(int from, int to)
        ssize_t nr;
        char buf[BUFSIZ];
 
-       while ((nr = read_all(from, buf, sizeof(buf))) > 0)
-               if (write_all(to, buf, nr) == -1)
+       while ((nr = ul_read_all(from, buf, sizeof(buf))) > 0)
+               if (ul_write_all(to, buf, nr) == -1)
                        return UL_COPY_WRITE_ERROR;
        if (nr < 0)
                return UL_COPY_READ_ERROR;
@@ -377,10 +377,10 @@ int ul_copy_file(int from, int to)
                return UL_COPY_READ_ERROR;
        if (!S_ISREG(st.st_mode))
                return copy_file_simple(from, to);
-       if (sendfile_all(to, from, NULL, st.st_size) < 0)
+       if (ul_sendfile_all(to, from, NULL, st.st_size) < 0)
                return copy_file_simple(from, to);
        /* ensure we either get an EOF or an error */
-       while ((nw = sendfile_all(to, from, NULL, 16*1024*1024)) != 0)
+       while ((nw = ul_sendfile_all(to, from, NULL, 16*1024*1024)) != 0)
                if (nw < 0)
                        return copy_file_simple(from, to);
        return 0;
index ec37f443917eb2e5323b99a923d615c1d83cac4b..2a30bf9e74bb833933469bfee75a985e454d65f3 100644 (file)
@@ -677,7 +677,7 @@ int ul_path_read(struct path_cxt *pc, char *buf, size_t len, const char *path)
                return -errno;
 
        DBG(CXT, ul_debug(" reading '%s'", path));
-       rc = read_all(fd, buf, len);
+       rc = ul_read_all(fd, buf, len);
 
        errsv = errno;
        close(fd);
@@ -954,7 +954,7 @@ int ul_path_write_string(struct path_cxt *pc, const char *str, const char *path)
        if (fd < 0)
                return -errno;
 
-       rc = write_all(fd, str, strlen(str));
+       rc = ul_write_all(fd, str, strlen(str));
 
        errsv = errno;
        close(fd);
@@ -988,7 +988,7 @@ int ul_path_write_s64(struct path_cxt *pc, int64_t num, const char *path)
        if (len < 0 || (size_t) len >= sizeof(buf))
                rc = len < 0 ? -errno : -E2BIG;
        else
-               rc = write_all(fd, buf, len);
+               rc = ul_write_all(fd, buf, len);
 
        errsv = errno;
        close(fd);
@@ -1010,7 +1010,7 @@ int ul_path_write_u64(struct path_cxt *pc, uint64_t num, const char *path)
        if (len < 0 || (size_t) len >= sizeof(buf))
                rc = len < 0 ? -errno : -E2BIG;
        else
-               rc = write_all(fd, buf, len);
+               rc = ul_write_all(fd, buf, len);
 
        errsv = errno;
        close(fd);
index 81f9c9f7d0477ff737d116f17feada63a9679b0f..fc8a25aba0ac7f9f0f01dd234d1e8102797df61b 100644 (file)
@@ -112,14 +112,14 @@ int plymouth_command(int cmd, ...)
                fdsock = open_un_socket_and_connect();
                if (fdsock >= 0) {
                        command[0] = cmd;
-                       write_all(fdsock, command, sizeof(command));
+                       ul_write_all(fdsock, command, sizeof(command));
                }
                break;
        case MAGIC_QUIT:
                fdsock = open_un_socket_and_connect();
                if (fdsock >= 0) {
                        command[0] = cmd;
-                       write_all(fdsock, command, sizeof(command));
+                       ul_write_all(fdsock, command, sizeof(command));
                }
                break;
        default:
@@ -131,7 +131,7 @@ int plymouth_command(int cmd, ...)
        answer[0] = '\0';
        if (fdsock >= 0) {
                if (can_read(fdsock, 1000))
-                       read_all(fdsock, (char *) &answer[0], sizeof(answer));
+                       ul_read_all(fdsock, (char *) &answer[0], sizeof(answer));
                close(fdsock);
        }
        sigaction(SIGPIPE, &op, NULL);
index 66e1eedccdb949f810e69409ced5a6d5035b721c..1f760a14426d07e9a8995ac234dacb27a656a0f2 100644 (file)
@@ -127,7 +127,7 @@ static ssize_t read_procfs_file(int fd, char *buf, size_t bufsz)
        if (fd < 0)
                return -EINVAL;
 
-       sz = read_all(fd, buf, bufsz);
+       sz = ul_read_all(fd, buf, bufsz);
        if (sz <= 0)
                return sz;
 
index adbbef979692067b8aae9bc1b17e4aef44983974..ba46ba2430fdeae5e61d0bdda739f1292a640b8b 100644 (file)
@@ -312,7 +312,7 @@ static int write_output(char *obuf, ssize_t bytes)
 {
        DBG(IO, ul_debug(" writing output"));
 
-       if (write_all(STDOUT_FILENO, obuf, bytes)) {
+       if (ul_write_all(STDOUT_FILENO, obuf, bytes)) {
                DBG(IO, ul_debug("  writing output *failed*"));
                return -errno;
        }
index a856854bd6c096143814a311f88e0ab265ed2a6d..ad8a88ed0ae99e9e4fe58d897afb45f04c9717d8 100644 (file)
@@ -474,7 +474,7 @@ static int sysfs_devchain_is_removable(char *chain)
                /* try to read it */
                fd = open(chain, O_RDONLY);
                if (fd != -1) {
-                       rc = read_all(fd, buf, sizeof(buf));
+                       rc = ul_read_all(fd, buf, sizeof(buf));
                        close(fd);
 
                        if (rc > 0) {
index bbe6d8c4651ca84bff718f39f92b8be6b83715e4..45691f4ad8660f8de489c056117ca30f1e793762 100644 (file)
@@ -1622,7 +1622,7 @@ int blkid_do_wipe(blkid_probe pr, int dryrun)
                        memset(buf, 0, len);
 
                        /* wipen on device */
-                       if (write_all(fd, buf, len))
+                       if (ul_write_all(fd, buf, len))
                                return BLKID_PROBE_ERROR;
                        if (fsync(fd) != 0)
                                return BLKID_PROBE_ERROR;
index cb988f04157f947742f33fd3bbc8b3509fcf2abc..6ecbdef6026aeda3b838090c8fd76355deda5cf6 100644 (file)
@@ -643,7 +643,7 @@ static int bsd_get_bootstrap(struct fdisk_context *cxt,
                return -errno;
        }
 
-       if (read_all(fd, ptr, size) != size) {
+       if (ul_read_all(fd, ptr, size) != size) {
                fdisk_warn(cxt, _("cannot read %s"), path);
                close(fd);
                return -errno;
@@ -720,7 +720,7 @@ int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt)
                rc = -errno;
                goto done;
        }
-       if (write_all(cxt->dev_fd, l->bsdbuffer, BSD_BBSIZE)) {
+       if (ul_write_all(cxt->dev_fd, l->bsdbuffer, BSD_BBSIZE)) {
                fdisk_warn(cxt, _("cannot write %s"), cxt->dev_path);
                rc = -errno;
                goto done;
@@ -839,7 +839,7 @@ static int bsd_readlabel(struct fdisk_context *cxt)
 
        if (lseek(cxt->dev_fd, offset, SEEK_SET) == -1)
                return -1;
-       if (read_all(cxt->dev_fd, l->bsdbuffer, sizeof(l->bsdbuffer)) < 0)
+       if (ul_read_all(cxt->dev_fd, l->bsdbuffer, sizeof(l->bsdbuffer)) < 0)
                return errno ? -errno : -1;
 
        /* The offset to begin of the disk label. Note that BSD uses
@@ -903,7 +903,7 @@ static int bsd_write_disklabel(struct fdisk_context *cxt)
                fdisk_warn(cxt, _("seek on %s failed"), cxt->dev_path);
                return -errno;
        }
-       if (write_all(cxt->dev_fd, l->bsdbuffer, sizeof(l->bsdbuffer))) {
+       if (ul_write_all(cxt->dev_fd, l->bsdbuffer, sizeof(l->bsdbuffer))) {
                fdisk_warn(cxt, _("cannot write %s"), cxt->dev_path);
                return -errno;
        }
index a2a9314c32beec9bd42db7f9f2ace152fcdda416..9f0139cf22d6fd867218095ebcaad1ba15271d94 100644 (file)
@@ -2067,7 +2067,7 @@ static int gpt_read(struct fdisk_context *cxt, off_t offset, void *buf, size_t c
        if (offset != lseek(cxt->dev_fd, offset, SEEK_SET))
                return -errno;
 
-       if (read_all(cxt->dev_fd, buf, count))
+       if (ul_read_all(cxt->dev_fd, buf, count))
                return -errno;
 
        DBG(GPT, ul_debug("  read OK [offset=%zu, size=%zu]",
@@ -2080,7 +2080,7 @@ static int gpt_write(struct fdisk_context *cxt, off_t offset, void *buf, size_t
        if (offset != lseek(cxt->dev_fd, offset, SEEK_SET))
                return -errno;
 
-       if (write_all(cxt->dev_fd, buf, count))
+       if (ul_write_all(cxt->dev_fd, buf, count))
                return -errno;
 
        if (fsync(cxt->dev_fd) != 0)
index a01e98c25a89d48edced86de0e1f428f771372a8..4b72ca70acaf3c7b66adb971bcb0f364435e3fbc 100644 (file)
@@ -1712,7 +1712,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
        fd = mkstemp_cloexec(name);
        if (fd < 0)
                err(EXIT_FAILURE, "mkstemp() failed");
-       if (write_all(fd, data, size) != 0)
+       if (ul_write_all(fd, data, size) != 0)
                err(EXIT_FAILURE, "write() failed");
        f = fopen(name, "r");
        if (!f)
index 4ddf8924d8f934f311059682a62e211ad95a8b5e..1ec14f0e03f53fa1ed0f1a18ca955cd72673e5ef 100644 (file)
@@ -484,7 +484,7 @@ static int sgi_write_disklabel(struct fdisk_context *cxt)
 
        if (lseek(cxt->dev_fd, 0, SEEK_SET) < 0)
                goto err;
-       if (write_all(cxt->dev_fd, sgilabel, DEFAULT_SECTOR_SIZE))
+       if (ul_write_all(cxt->dev_fd, sgilabel, DEFAULT_SECTOR_SIZE))
                goto err;
        if (!strncmp((char *) sgilabel->volume[0].name, "sgilabel", 8)) {
                /*
@@ -500,7 +500,7 @@ static int sgi_write_disklabel(struct fdisk_context *cxt)
                info = sgi_new_info();
                if (!info)
                        goto err;
-               if (write_all(cxt->dev_fd, info, sizeof(*info)))
+               if (ul_write_all(cxt->dev_fd, info, sizeof(*info)))
                        goto err;
        }
 
index b55d0e291f1b39e0aa321467289af9b1e94cd50d..2328b03ec224b7e89ddda80a078a479d1d93cb82 100644 (file)
@@ -1026,7 +1026,7 @@ static int sun_write_disklabel(struct fdisk_context *cxt)
 
        if (lseek(cxt->dev_fd, 0, SEEK_SET) < 0)
                return -errno;
-       if (write_all(cxt->dev_fd, sunlabel, sz) != 0)
+       if (ul_write_all(cxt->dev_fd, sunlabel, sz) != 0)
                return -errno;
 
        return 0;
index 88c04e14c552eea375c8713c49c4226281433c2f..8be6cdc1ea16cbfee0ce4099aef4a11cfbb8c5cd 100644 (file)
@@ -100,7 +100,7 @@ static int write_id_mapping(idmap_type_t map_type, pid_t pid, const char *buf,
                        goto err;
 
                if (setgroups_fd >= 0) {
-                       rc = write_all(setgroups_fd, "deny\n", strlen("deny\n"));
+                       rc = ul_write_all(setgroups_fd, "deny\n", strlen("deny\n"));
                        if (rc)
                                goto err;
                }
@@ -113,7 +113,7 @@ static int write_id_mapping(idmap_type_t map_type, pid_t pid, const char *buf,
        if (fd < 0)
                goto err;
 
-       rc = write_all(fd, buf, buf_size);
+       rc = ul_write_all(fd, buf, buf_size);
 
 err:
        if (fd >= 0)
@@ -213,12 +213,12 @@ static int get_userns_fd_from_idmap(struct list_head *idmap)
                        _exit(EXIT_FAILURE);
 
                /* Let parent know we're ready to have the idmapping written. */
-               rc = write_all(sock_fds[0], &c, 1);
+               rc = ul_write_all(sock_fds[0], &c, 1);
                if (rc)
                        _exit(EXIT_FAILURE);
 
                /* Hang around until the parent has persisted our namespace. */
-               rc = read_all(sock_fds[0], &c, 1);
+               rc = ul_read_all(sock_fds[0], &c, 1);
                if (rc != 1)
                        _exit(EXIT_FAILURE);
 
@@ -230,7 +230,7 @@ static int get_userns_fd_from_idmap(struct list_head *idmap)
        sock_fds[0] = -1;
 
        /* Wait for child to set up a new namespace. */
-       rc = read_all(sock_fds[1], &c, 1);
+       rc = ul_read_all(sock_fds[1], &c, 1);
        if (rc != 1) {
                kill(pid, SIGKILL);
                goto err_wait;
@@ -246,7 +246,7 @@ static int get_userns_fd_from_idmap(struct list_head *idmap)
        fd_userns = open(path, O_RDONLY | O_CLOEXEC | O_NOCTTY);
 
        /* Let child know we've persisted its namespace. */
-       (void)write_all(sock_fds[1], &c, 1);
+       (void)ul_write_all(sock_fds[1], &c, 1);
 
 err_wait:
        rc = wait_for_pid(pid);
index 4cc32e964aadd188a947d477873b4ec1a5f9cdd0..9eae922998fa446b940872b89e57dd0a56b54546 100644 (file)
@@ -509,14 +509,14 @@ static int get_uuid_via_daemon(int op, uuid_t out, int *num)
        if (ret < 1)
                goto fail;
 
-       ret = read_all(s, (char *) &reply_len, sizeof(reply_len));
+       ret = ul_read_all(s, (char *) &reply_len, sizeof(reply_len));
        if (ret < 0)
                goto fail;
 
        if (reply_len != expected)
                goto fail;
 
-       ret = read_all(s, op_buf, reply_len);
+       ret = ul_read_all(s, op_buf, reply_len);
 
        if (op == UUIDD_OP_BULK_TIME_UUID)
                memcpy(op_buf+16, num, sizeof(int));
index 1f5b800c8f659876943150ca6e33e94091559559..0292bb8e7c04797b17dc9038ab6b8d971b5f1ca8 100644 (file)
@@ -964,7 +964,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
        fd = mkstemp_cloexec(name);
        if (fd < 0)
                err(EXIT_FAILURE, "mkstemp() failed");
-       if (write_all(fd, data, size) != 0)
+       if (ul_write_all(fd, data, size) != 0)
                err(EXIT_FAILURE, "write() failed");
 
        process_wtmp_file(&ctl, name);
index f1438b8e83ee11d84bc147bdb532c23d503d290c..008842da0ded29342dfca990a9387f1ac24a3555 100644 (file)
@@ -282,7 +282,7 @@ int main(int argc, char **argv)
        INSTR(BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW));
 
        if (dump) {
-               if (fwrite_all(filter, (f - filter) * sizeof(filter[0]), 1, dump))
+               if (ul_fwrite_all(filter, (f - filter) * sizeof(filter[0]), 1, dump))
                        err(EXIT_FAILURE, _("Could not dump seccomp filter"));
                return EXIT_SUCCESS;
        }
index 4d2029d55d23d68779cb5b02fefa88d8898014a6..96981a762cee294196fd169e137b4614bb1d1f19 100644 (file)
@@ -283,7 +283,7 @@ static int64_t get_namespace_offset(const char *name)
        if (fd == -1)
                err(EXIT_FAILURE, _("Could not open %s"), _PATH_PROC_TIMENS_OFF);
 
-       read_all_alloc(fd, &buf);
+       ul_read_all_alloc(fd, &buf);
 
        for (tokstr = buf; ; tokstr = NULL) {
                line = strtok_r(tokstr, "\n", &saveptr);
index 38b17d394370b609de6b5e53846ce6ad5b5c693f..176168ba0c198202ff021da764d4e4f26943dc54 100644 (file)
@@ -69,7 +69,7 @@ static uint64_t hash_file(struct mcookie_control *ctl, int fd)
                if (wanted - count < rdsz)
                        rdsz = wanted - count;
 
-               r = read_all(fd, (char *) buf, rdsz);
+               r = ul_read_all(fd, (char *) buf, rdsz);
                if (r <= 0)
                        break;
                ul_MD5Update(&ctl->ctx, buf, r);
index 91e3053449dc9f8fdca9c023bc6d85362703270e..10890428f5bc158cf66b6071bf1e99254832c50a 100644 (file)
@@ -178,7 +178,7 @@ static int call_daemon(const char *socket_path, uuidd_prot_op_t op, char *buf,
                op_len += sizeof(*num);
        }
 
-       ret = write_all(s, op_buf, op_len);
+       ret = ul_write_all(s, op_buf, op_len);
        if (ret < 0) {
                if (err_context)
                        *err_context = _("write");
@@ -186,7 +186,7 @@ static int call_daemon(const char *socket_path, uuidd_prot_op_t op, char *buf,
                return -1;
        }
 
-       ret = read_all(s, (char *) &reply_len, sizeof(reply_len));
+       ret = ul_read_all(s, (char *) &reply_len, sizeof(reply_len));
        if (ret < 0) {
                if (err_context)
                        *err_context = _("read count");
@@ -199,7 +199,7 @@ static int call_daemon(const char *socket_path, uuidd_prot_op_t op, char *buf,
                close(s);
                return -1;
        }
-       ret = read_all(s, (char *) buf, reply_len);
+       ret = ul_read_all(s, (char *) buf, reply_len);
 
        if ((ret > 0) && (op == UUIDD_OP_BULK_TIME_UUID)) {
                if ((sizeof(uuid_t) + sizeof(*num)) <= (size_t) reply_len)
@@ -402,7 +402,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                        snprintf(reply_buf, sizeof(reply_buf), "%8d\n", getpid());
                        if (ftruncate(fd_pidfile, 0))
                                err(EXIT_FAILURE, _("could not truncate file: %s"), pidfile_path);
-                       write_all(fd_pidfile, reply_buf, strlen(reply_buf));
+                       ul_write_all(fd_pidfile, reply_buf, strlen(reply_buf));
                        if (fd_pidfile > 1 && close_fd(fd_pidfile) != 0)
                                err(EXIT_FAILURE, _("write failed: %s"), pidfile_path);
                }
@@ -479,7 +479,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                }
                if ((op == UUIDD_OP_BULK_TIME_UUID) ||
                    (op == UUIDD_OP_BULK_RANDOM_UUID)) {
-                       if (read_all(ns, (char *) &num, sizeof(num)) != sizeof(num))
+                       if (ul_read_all(ns, (char *) &num, sizeof(num)) != sizeof(num))
                                goto shutdown_socket;
                        if (uuidd_cxt->debug)
                                fprintf(stderr, _("operation %d, incoming num = %d\n"),
@@ -560,8 +560,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
                                fprintf(stderr, _("Invalid operation %d\n"), op);
                        goto shutdown_socket;
                }
-               write_all(ns, (char *) &reply_len, sizeof(num));
-               write_all(ns, reply_buf, reply_len);
+               ul_write_all(ns, (char *) &reply_len, sizeof(num));
+               ul_write_all(ns, reply_buf, reply_len);
        shutdown_socket:
                close(ns);
        }
index 8020c26b06f264323cf02b8afad7da8c996ce64d..dad1ad277435c14f87fcb53aa29f0dde30b25415 100644 (file)
@@ -478,7 +478,7 @@ static void do_backup(struct wipe_desc *wp, const char *base)
        fd = open(fname, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
        if (fd < 0)
                goto err;
-       if (write_all(fd, wp->magic, wp->len) != 0)
+       if (ul_write_all(fd, wp->magic, wp->len) != 0)
                goto err;
        close(fd);
        free(fname);
index eba8da1266476c40db7760c99772a5a9eeef3a43..de3b87b23bad998a56586983d29a441844f09c0f 100644 (file)
@@ -463,7 +463,7 @@ int main(int argc, char **argv)
        if (introparm && *introparm)
        {
                dbg("intro command is '%s'", introparm);
-               if (write_all(tty_fd, introparm, strlen(introparm)) != 0)
+               if (ul_write_all(tty_fd, introparm, strlen(introparm)) != 0)
                        err(EXIT_FAILURE,
                            _("cannot write intro command to %s"), dev);
 
index 5cdb4834b15172389037a18b7f120b364c75a176..e8ed36d2ca249c984d7347d0faeba7602ba56f01 100644 (file)
@@ -75,7 +75,7 @@ void *get_mem_chunk(size_t base, size_t len, const char *devmem)
                goto nothing;
        if (lseek(fd, base, SEEK_SET) == -1)
                goto nothing;
-       if (read_all(fd, p, len) == -1)
+       if (ul_read_all(fd, p, len) == -1)
                goto nothing;
 
        close(fd);
index c1706cef948d5874bcda741a4ec8d43cff8442fe..5fbef8746d54dd53aa461f3f70b48407cdaeb85c 100644 (file)
@@ -475,7 +475,7 @@ static void open_cgroup_procs(void)
 
        open_target_fd(&cgroup_fd, "cgroup", optarg);
 
-       if (read_all_alloc(cgroup_fd, &buf) < 1)
+       if (ul_read_all_alloc(cgroup_fd, &buf) < 1)
                err(EXIT_FAILURE, _("failed to get cgroup path"));
 
        p = strtok(buf, "\n");
@@ -512,7 +512,7 @@ static void join_into_cgroup(void)
 
        pid = getpid();
        len = snprintf(buf, sizeof(buf), "%zu", (size_t) pid);
-       if (write_all(cgroup_procs_fd, buf, len))
+       if (ul_write_all(cgroup_procs_fd, buf, len))
                err(EXIT_FAILURE, _("write cgroup.procs failed"));
 }
 
index e718328a8681162c547376e3250d9a47a9d13719..989c8ee96ef13eeea568a2701824e18a133eb0f9 100644 (file)
@@ -562,7 +562,7 @@ static int __rfkill_block(int fd, struct rfkill_id *id, uint8_t block, const cha
                abort();
        }
 
-       if (write_all(fd, &event, sizeof(event)) != 0)
+       if (ul_write_all(fd, &event, sizeof(event)) != 0)
                warn(_("write failed: %s"), _PATH_DEV_RFKILL);
        else {
                openlog("rfkill", 0, LOG_USER);
index 9ec3ed96a755b84acddb0f876058dbd55e944df9..8ec571c505e32d66737700538e59ad995091e57b 100644 (file)
@@ -742,7 +742,7 @@ static void do_seccomp_filter(const char *file)
                err(SETPRIV_EXIT_PRIVERR,
                    _("cannot open %s"), file);
 
-       s = read_all_alloc(fd, &filter);
+       s = ul_read_all_alloc(fd, &filter);
        if (s < 0)
                err(SETPRIV_EXIT_PRIVERR,
                    _("cannot read %s"), file);
index 1e96ba478c39ccac6621e1bd03ba12fc299792fc..4c4901a20d35a8494565dc1aa7984de85ba39811 100644 (file)
@@ -122,7 +122,7 @@ static void setgroups_control(int action)
                err(EXIT_FAILURE, _("cannot open %s"), file);
        }
 
-       if (write_all(fd, cmd, strlen(cmd)))
+       if (ul_write_all(fd, cmd, strlen(cmd)))
                err(EXIT_FAILURE, _("write failed %s"), file);
        close(fd);
 }
@@ -137,7 +137,7 @@ static void map_id(const char *file, uint32_t from, uint32_t to)
                 err(EXIT_FAILURE, _("cannot open %s"), file);
 
        xasprintf(&buf, "%u %u 1", from, to);
-       if (write_all(fd, buf, strlen(buf)))
+       if (ul_write_all(fd, buf, strlen(buf)))
                err(EXIT_FAILURE, _("write failed %s"), file);
        free(buf);
        close(fd);
@@ -273,7 +273,7 @@ static void sync_with_child(pid_t pid, int fd)
 {
        uint64_t ch = PIPE_SYNC_BYTE;
 
-       write_all(fd, &ch, sizeof(ch));
+       ul_write_all(fd, &ch, sizeof(ch));
        close(fd);
 
        waitchild(pid);
@@ -307,7 +307,7 @@ static pid_t fork_and_wait(int *fd)
 
        if (!pid) {
                /* wait for the our parent to tell us to continue */
-               if (read_all(*fd, (char *)&ch, sizeof(ch)) != sizeof(ch) ||
+               if (ul_read_all(*fd, (char *)&ch, sizeof(ch)) != sizeof(ch) ||
                    ch != PIPE_SYNC_BYTE)
                        err(EXIT_FAILURE, _("failed to read eventfd"));
                close(*fd);
@@ -660,7 +660,7 @@ static void map_ids_internal(const char *type, int ppid, struct map_range *chain
        fd = open(path, O_WRONLY | O_CLOEXEC | O_NOCTTY);
        if (fd < 0)
                err(EXIT_FAILURE, _("failed to open %s"), path);
-       if (write_all(fd, buffer, length) < 0)
+       if (ul_write_all(fd, buffer, length) < 0)
                err(EXIT_FAILURE, _("failed to write %s"), path);
        close(fd);
        free(path);
@@ -733,7 +733,7 @@ static void load_interp(const char *binfmt_mnt, const char *interp)
        if (fd < 0)
                err(EXIT_FAILURE, _("cannot open %s/register"), binfmt_mnt);
 
-       if (write_all(fd, interp, strlen(interp)))
+       if (ul_write_all(fd, interp, strlen(interp)))
                err(EXIT_FAILURE, _("write failed %s/register"), binfmt_mnt);
 
        close(fd);
index d7c885c71ab055159580f0d5c0d1fbf9aafc59cb..3991ea6461fa2678f6ddeeabaa1653d9a9881af0 100644 (file)
@@ -499,7 +499,7 @@ static ssize_t log_write(struct script_control *ctl,
        switch (log->format) {
        case SCRIPT_FMT_RAW:
                DBG(IO, ul_debug("  log raw data"));
-               rc = fwrite_all(obuf, 1, bytes, log->fp);
+               rc = ul_fwrite_all(obuf, 1, bytes, log->fp);
                if (rc) {
                        warn(_("cannot write %s"), log->filename);
                        return rc;
index a9df5cb602a3983298dbacb9e536a4a15d811b18..8ec0668bff2f07582cb164e2fbb71cf4ecb98b2a 100644 (file)
@@ -896,7 +896,7 @@ static int resizetty(void)
                errx(EXIT_FAILURE, _("stdin does not refer to a terminal"));
 
        tty_raw(&saved_attributes, &saved_fl);
-       if (write_all(STDIN_FILENO, getpos, strlen(getpos)) < 0) {
+       if (ul_write_all(STDIN_FILENO, getpos, strlen(getpos)) < 0) {
                warn(_("write failed"));
                tty_restore(&saved_attributes, &saved_fl);
                return 1;
index 939086bc88f32d30c52ae0389a4da43011fff1eb..2e3a03981c0385379cebc45eefc62e7cc7181dbb 100644 (file)
@@ -296,7 +296,7 @@ static size_t xmbstowcs(wchar_t * pwcs, const char *s, size_t nwcs)
 static int outcap(int i)
 {
        char c = i;
-       return write_all(STDOUT_FILENO, &c, 1) == 0 ? 1 : -1;
+       return ul_write_all(STDOUT_FILENO, &c, 1) == 0 ? 1 : -1;
 }
 
 /* Write messages to terminal. */
@@ -306,7 +306,7 @@ static void mesg(const char *message)
                return;
        if (*message != '\n' && sflag)
                vidputs(A_STANDOUT, outcap);
-       write_all(STDOUT_FILENO, message, strlen(message));
+       ul_write_all(STDOUT_FILENO, message, strlen(message));
        if (*message != '\n' && sflag)
                vidputs(A_NORMAL, outcap);
 }
@@ -518,7 +518,7 @@ static void cline(void)
        memset(buf, ' ', ttycols + 2);
        buf[0] = '\r';
        buf[ttycols + 1] = '\r';
-       write_all(STDOUT_FILENO, buf, ttycols + 2);
+       ul_write_all(STDOUT_FILENO, buf, ttycols + 2);
        free(buf);
 }
 
@@ -646,7 +646,7 @@ static void prompt(long long pageno)
                }
                if (key == tio.c_cc[VERASE]) {
                        if (cmd.cmdlen) {
-                               write_all(STDOUT_FILENO, "\b \b", 3);
+                               ul_write_all(STDOUT_FILENO, "\b \b", 3);
                                cmd.cmdline[--cmd.cmdlen] = '\0';
                                switch (state) {
                                case ADDON_FIN:
@@ -748,7 +748,7 @@ static void prompt(long long pageno)
                                cmd.key = key;
                        }
                }
-               write_all(STDOUT_FILENO, &key, 1);
+               ul_write_all(STDOUT_FILENO, &key, 1);
 
                if (cmd.cmdlen + 1 >= sizeof(cmd.cmdline))
                        goto endprompt;
@@ -935,7 +935,7 @@ static void pgfile(FILE *f, const char *name)
        if (ontty == 0) {
                /* Just copy stdin to stdout. */
                while ((sz = fread(b, sizeof *b, READBUF, f)) != 0)
-                       write_all(STDOUT_FILENO, b, sz);
+                       ul_write_all(STDOUT_FILENO, b, sz);
                if (ferror(f)) {
                        warn("%s", name);
                        exitstatus++;
@@ -1012,7 +1012,7 @@ static void pgfile(FILE *f, const char *name)
 
                                if (!nobuf)
                                        fputs(b, fbuf);
-                               fwrite_all(&pos, sizeof pos, 1, find);
+                               ul_fwrite_all(&pos, sizeof pos, 1, find);
                                if (!fflag) {
                                        oldpos = pos;
                                        p = b;
@@ -1020,7 +1020,7 @@ static void pgfile(FILE *f, const char *name)
                                                             p))
                                               != '\0') {
                                                pos = oldpos + (p - b);
-                                               fwrite_all(&pos,
+                                               ul_fwrite_all(&pos,
                                                           sizeof pos,
                                                           1, find);
                                                fline++;
@@ -1090,7 +1090,7 @@ static void pgfile(FILE *f, const char *name)
                                sz = p - b;
                                makeprint(b, sz);
                                canjump = 1;
-                               write_all(STDOUT_FILENO, b, sz);
+                               ul_write_all(STDOUT_FILENO, b, sz);
                                canjump = 0;
                        }
                }
@@ -1234,7 +1234,7 @@ static void pgfile(FILE *f, const char *name)
                                        }
                                        if (!nobuf)
                                                fputs(b, fbuf);
-                                       fwrite_all(&pos, sizeof pos, 1, find);
+                                       ul_fwrite_all(&pos, sizeof pos, 1, find);
                                        if (!fflag) {
                                                oldpos = pos;
                                                p = b;
@@ -1242,7 +1242,7 @@ static void pgfile(FILE *f, const char *name)
                                                                     p))
                                                       != '\0') {
                                                        pos = oldpos + (p - b);
-                                                       fwrite_all(&pos,
+                                                       ul_fwrite_all(&pos,
                                                                   sizeof pos,
                                                                   1, find);
                                                        fline++;
@@ -1256,7 +1256,7 @@ static void pgfile(FILE *f, const char *name)
                                while ((sz = fread(b, sizeof *b, READBUF,
                                                   fbuf)) != 0) {
                                        /* No error check for compat. */
-                                       fwrite_all(b, sizeof *b, sz, save);
+                                       ul_fwrite_all(b, sizeof *b, sz, save);
                                }
                                if (close_stream(save) != 0) {
                                        cmd.count = errno;
@@ -1362,9 +1362,9 @@ static void pgfile(FILE *f, const char *name)
                                } else {
                                        pid_t cpid;
 
-                                       write_all(STDOUT_FILENO, cmd.cmdline,
+                                       ul_write_all(STDOUT_FILENO, cmd.cmdline,
                                                  strlen(cmd.cmdline));
-                                       write_all(STDOUT_FILENO, "\n", 1);
+                                       ul_write_all(STDOUT_FILENO, "\n", 1);
                                        my_sigset(SIGINT, SIG_IGN);
                                        my_sigset(SIGQUIT, SIG_IGN);
                                        switch (cpid = fork()) {
@@ -1406,9 +1406,9 @@ static void pgfile(FILE *f, const char *name)
                                {
                                        /* Help! */
                                        const char *help = _(helpscreen);
-                                       write_all(STDOUT_FILENO, copyright,
+                                       ul_write_all(STDOUT_FILENO, copyright,
                                                  strlen(copyright));
-                                       write_all(STDOUT_FILENO, help,
+                                       ul_write_all(STDOUT_FILENO, help,
                                                  strlen(help));
                                        goto newcmd;
                                }
@@ -1528,9 +1528,9 @@ static int parse_arguments(int arg, int argc, char **argv)
                }
                if (ontty == 0 && argc > 2) {
                        /* Use the prefix as specified by SUSv2. */
-                       write_all(STDOUT_FILENO, "::::::::::::::\n", 15);
-                       write_all(STDOUT_FILENO, argv[arg], strlen(argv[arg]));
-                       write_all(STDOUT_FILENO, "\n::::::::::::::\n", 16);
+                       ul_write_all(STDOUT_FILENO, "::::::::::::::\n", 15);
+                       ul_write_all(STDOUT_FILENO, argv[arg], strlen(argv[arg]));
+                       ul_write_all(STDOUT_FILENO, "\n::::::::::::::\n", 16);
                }
                pgfile(input, argv[arg]);
                if (input != stdin)