if (ret < 0)
return ret;
- if (bytes_read <= terminal->log_size)
+ if ((uint64_t)bytes_read <= terminal->log_size)
return lxc_write_nointr(terminal->log_fd, buf, bytes_read);
/* Write as much as we can into the buffer and loose the rest. */
if (ret < 0)
return ret;
- if (terminal->log_size < bytes_read) {
+ if (terminal->log_size < (uint64_t)bytes_read) {
/* Well, this is unfortunate because it means that there is more
* to write than the user has granted us space. There are
* multiple ways to handle this but let's use the simplest one:
int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttyreq)
{
- int ttynum;
+ size_t ttynum;
int ptxfd = -1;
struct lxc_tty_info *ttys = &conf->ttys;
struct lxc_terminal *terminal = &conf->console;
}
if (*ttyreq > 0) {
- if (*ttyreq > ttys->max)
+ if ((size_t)*ttyreq > ttys->max)
goto out;
if (ttys->tty[*ttyreq - 1].busy >= 0)
if (ttynum > ttys->max)
goto out;
- *ttyreq = ttynum;
+ *ttyreq = (int)ttynum;
out_tty:
ttys->tty[ttynum - 1].busy = sockfd;
void lxc_terminal_free(struct lxc_conf *conf, int fd)
{
- int i;
struct lxc_tty_info *ttys = &conf->ttys;
struct lxc_terminal *terminal = &conf->console;
- for (i = 0; i < ttys->max; i++)
+ for (size_t i = 0; i < ttys->max; i++)
if (ttys->tty[i].busy == fd)
ttys->tty[i].busy = -1;