search for: close_stdout

Displaying 6 results from an estimated 6 matches for "close_stdout".

2009 Sep 11
1
[PATCH] guestfish: Redirect stdout when executing remote commands
...o the message */ + msg.msg_control = cmptr; + msg.msg_controllen = controllen; + + /* Add STDOUT to the control data */ + *(int *)CMSG_DATA (cmptr) = STDOUT_FILENO; + + if (sendmsg (s, &msg, 0) != 1) { + perror ("sendmsg stdout fd"); + exit (1); + } +} + +static void +close_stdout (void) +{ + int fd; + + fd = open ("/dev/null", O_WRONLY); + if (fd == -1) + perror ("/dev/null"); + else { + dup2 (fd, STDOUT_FILENO); + close (fd); + } +} + /* Remote control server. */ void rc_listen (void) @@ -56,7 +175,7 @@ rc_listen (void) char sockpath...
2009 Aug 24
5
[0/5] guestfish: detect stdout-write failure
...bviously, including the absolute program name in the diagnostic is a bug. It should be "guestfish", and there's already code to perform that sanitization in the patch below. It fixes everything except the glibc global variable, program_invocation_name, used by error, called by atexit+close_stdout. I'll fix that via gnulib's progname module later today or tomorrow. Note that all other diagnostics (e.g., below) do use the sanitized name. The second patch is to make guestfish write --help output to stdout, not stderr, per convention. Also, since --help output is pretty long, I find...
2012 May 02
0
[PATCH] fish: Add --pipe-error flag to allow detection of errors in pipe commands (RHBZ#803533).
...uot; " --remote[=pid] Send commands to remote %s\n" @@ -158,6 +160,7 @@ main (int argc, char *argv[]) /* Set global program name that is not polluted with libtool artifacts. */ set_program_name (argv[0]); + /* Initialize gnulib closeout module. */ atexit (close_stdout); setlocale (LC_ALL, ""); @@ -190,6 +193,7 @@ main (int argc, char *argv[]) { "new", 1, 0, 'N' }, { "no-dest-paths", 0, 0, 'D' }, { "no-sync", 0, 0, 'n' }, + { "pipe-error", 0, 0, 0 }, { "prog...
2019 Sep 16
2
ssh client is setting O_NONBLOCK on a pipe shared with other processes
...set O_NONBLOCK are required to handle EAGAIN or short counts. They *may* need to deal with EINTR but signals don't come out of nowhere either and many programs run in an environment where EINTR is also unexpected. We are using GNU make 3.81 but newer versions of gmake do the same thing: void close_stdout (void) { int prev_fail = ferror (stdout); int fclose_fail = fclose (stdout); if (prev_fail || fclose_fail) { if (fclose_fail) error (NILF, _("write error: %s"), strerror (errno)); else error (NILF, _("write error")); exit (EXIT_FAILUR...
2019 Sep 15
4
ssh client is setting O_NONBLOCK on a pipe shared with other processes
The quick summary is that we invoke git from a parallel invocation of "make". Git invokes ssh to pull stuff from a remote repo. Ssh sets O_NONBLOCK on stdout and stderr if they do not refer to a tty. During our build, stderr refers to a pipe that other jobs run by make (and make itself) may also write to, and since this is a parallel build, they may write to that pipe while ssh has it
2016 Aug 18
5
[PATCH v2 0/4] New getprogname module
Hi, as discussed in [1], this series adds a new getprogname module. All it does is providing a getprogname function, much like what is found on e.g. *BSD systems, and using it in gnulib instead of progname. Also, using it explicitly by modules avoids gnulib users the need of either use the progname module (GPL), or to provide program_name (and call set_program_name manually, which is not always