Don't accept UINT_MAX as size if no clients/sessions.

This commit is contained in:
Nicholas Marriott 2007-10-04 20:01:10 +00:00
parent 032ee1b880
commit 5c54e0b7fd
3 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-new-session.c,v 1.7 2007-10-04 19:03:51 nicm Exp $ */
/* $Id: cmd-new-session.c,v 1.8 2007-10-04 20:01:09 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -74,7 +74,6 @@ cmd_new_session_parse(void **ptr, int argc, char **argv, char **cause)
}
argc -= optind;
argv += optind;
if (argc != 0 && argc != 1)
goto usage;
@ -128,7 +127,6 @@ cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
cmd = data->cmd;
if (cmd == NULL)
cmd = default_command;
c->session = session_create(data->name, cmd, c->sx, sy);
if (c->session == NULL)

View File

@ -1,4 +1,4 @@
/* $Id: resize.c,v 1.1 2007-10-04 19:03:51 nicm Exp $ */
/* $Id: resize.c,v 1.2 2007-10-04 20:01:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -61,6 +61,8 @@ recalculate_sizes(void)
if (c->sy < ssy)
ssy = c->sy;
}
if (ssx == UINT_MAX || ssy == UINT_MAX)
continue;
if (ssy < status_lines)
ssy = status_lines + 1;
ssy -= status_lines;
@ -89,6 +91,8 @@ recalculate_sizes(void)
if (s->sy < ssy)
ssy = s->sy;
}
if (ssx == UINT_MAX || ssy == UINT_MAX)
continue;
if (w->screen.sx == ssx && w->screen.sy == ssy)
continue;

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.24 2007-10-04 19:03:52 nicm Exp $ */
/* $Id: server.c,v 1.25 2007-10-04 20:01:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -282,7 +282,10 @@ server_accept_client(int srv_fd)
c->fd = client_fd;
c->in = buffer_create(BUFSIZ);
c->out = buffer_create(BUFSIZ);
c->session = NULL;
c->sx = 80;
c->sy = 25;
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
if (ARRAY_ITEM(&clients, i) == NULL) {