sudo frontend: silence most -Wconversion warnings.

This commit is contained in:
Todd C. Miller
2023-07-07 15:07:04 -06:00
parent 0c85f10c80
commit 32f4b98f6b
23 changed files with 185 additions and 171 deletions

View File

@@ -418,11 +418,11 @@ read_callback(int fd, int what, void *v)
default:
sudo_debug_printf(SUDO_DEBUG_INFO,
"read %zd bytes from fd %d", n, fd);
if (!iob->action(iob->buf + iob->len, n, iob)) {
if (!iob->action(iob->buf + iob->len, (unsigned int)n, iob)) {
terminate_command(iob->ec->cmnd_pid, true);
iob->ec->cmnd_pid = -1;
}
iob->len += n;
iob->len += (unsigned int)n;
/* Disable reader if buffer is full. */
if (iob->len == sizeof(iob->buf))
sudo_ev_del(evbase, iob->revent);
@@ -484,7 +484,7 @@ write_callback(int fd, int what, void *v)
case EBADF:
/* other end of pipe closed or pty revoked */
sudo_debug_printf(SUDO_DEBUG_INFO,
"unable to write %d bytes to fd %d",
"unable to write %u bytes to fd %d",
iob->len - iob->off, fd);
/* Close reader if there is one. */
if (iob->revent != NULL) {
@@ -515,7 +515,7 @@ write_callback(int fd, int what, void *v)
} else {
sudo_debug_printf(SUDO_DEBUG_INFO,
"wrote %zd bytes to fd %d", n, fd);
iob->off += n;
iob->off += (unsigned int)n;
/* Disable writer and reset the buffer if fully consumed. */
if (iob->off == iob->len) {
iob->off = iob->len = 0;
@@ -946,8 +946,8 @@ fill_exec_closure(struct exec_closure *ec, struct command_status *cstat,
ec->cmnd_pid = -1;
ec->cstat = cstat;
ec->details = details;
ec->rows = user_details->ts_rows;
ec->cols = user_details->ts_cols;
ec->rows = (short)user_details->ts_rows;
ec->cols = (short)user_details->ts_cols;
/* Reset cstat for running the command. */
cstat->type = CMD_INVALID;
@@ -1464,8 +1464,8 @@ sync_ttysize(struct exec_closure *ec)
killpg(ec->cmnd_pid, SIGWINCH);
/* Update rows/cols. */
ec->rows = wsize.ws_row;
ec->cols = wsize.ws_col;
ec->rows = (short)wsize.ws_row;
ec->cols = (short)wsize.ws_col;
}
}