diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-01-21 23:44:13 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-01-21 23:44:13 +0000 |
commit | 492e3aa4373f0f20a8685cfb3591a9730bb0454a (patch) | |
tree | 3f11c4b5b3b68706442324e1be636c07e25d3db5 /job.c | |
parent | 6b19621112c2fccdcde88f864291ef0939820b0d (diff) | |
download | rtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.tar.gz rtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.tar.bz2 rtmux-492e3aa4373f0f20a8685cfb3591a9730bb0454a.zip |
Sync OpenBSD patchset 834:
Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things
like "tmux ls && cat").
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: job.c,v 1.19 2010-10-24 00:45:57 tcunha Exp $ */ +/* $Id: job.c,v 1.20 2011-01-21 23:44:13 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -136,7 +136,7 @@ job_free(struct job *job) int job_run(struct job *job) { - int nullfd, out[2], mode; + int nullfd, out[2]; if (job->fd != -1 || job->pid != -1) return (0); @@ -176,10 +176,7 @@ job_run(struct job *job) close(out[1]); job->fd = out[0]; - if ((mode = fcntl(job->fd, F_GETFL)) == -1) - fatal("fcntl failed"); - if (fcntl(job->fd, F_SETFL, mode|O_NONBLOCK) == -1) - fatal("fcntl failed"); + setblocking(job->fd, 0); if (job->event != NULL) bufferevent_free(job->event); |