=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/status.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- src/usr.bin/tmux/status.c 2009/11/04 20:35:19 1.40 +++ src/usr.bin/tmux/status.c 2009/11/04 21:04:43 1.41 @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.40 2009/11/04 20:35:19 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.41 2009/11/04 21:04:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -486,23 +486,26 @@ void status_job_callback(struct job *job) { - char *buf; + char *line, *buf; size_t len; - len = BUFFER_USED(job->out); - buf = xmalloc(len + 1); - if (len != 0) - buffer_read(job->out, buf, len); - buf[len] = '\0'; - buf[strcspn(buf, "\n")] = '\0'; + buf = NULL; + if ((line = evbuffer_readline(job->event->input)) == NULL) { + len = EVBUFFER_LENGTH(job->event->input); + buf = xmalloc(len + 1); + if (len != 0) + memcpy(buf, EVBUFFER_DATA(job->event->input), len); + buf[len] = '\0'; + } if (job->data != NULL) xfree(job->data); else server_redraw_client(job->client); - job->data = xstrdup(buf); + job->data = xstrdup(line); - xfree(buf); + if (buf != NULL) + xfree(buf); } size_t