search for: se_fd

Displaying 13 results from an estimated 13 matches for "se_fd".

2012 Dec 13
2
[PATCH 1/2] daemon: NFC Use symbolic names in commandrvf
...dup2 (stdin_fd[PIPE_READ], STDIN_FILENO); + close (stdin_fd[PIPE_READ]); + close (stdin_fd[PIPE_WRITE]); } else { /* Set stdin to /dev/null (ignore failure) */ ignore_value (open ("/dev/null", O_RDONLY|O_CLOEXEC)); } - close (so_fd[0]); - close (se_fd[0]); + close (so_fd[PIPE_READ]); + close (se_fd[PIPE_READ]); if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) - dup2 (so_fd[1], 1); + dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO); else - dup2 (se_fd[1], 1); - dup2 (se_fd[1], 2); - close (so_fd[1]); - close (...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...is ORed with the flags, and that file + * descriptor is always closed by this function. See hexdump.c for an + * example of usage. + */ +int +commandrvf (char **stdoutput, char **stderror, unsigned flags, + char const* const *argv) +{ + size_t so_size = 0, se_size = 0; + int so_fd[2], se_fd[2]; + unsigned flag_copy_stdin = flags & COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN; + int flag_copy_fd = (int) (flags & COMMAND_FLAG_FD_MASK); + pid_t pid; + int r, quit, i; + fd_set rset, rset2; + char buf[256]; + char *p; + + if (stdoutput) *stdoutput = NULL; + if (stderror) *stderr...
2015 Dec 02
3
[PATCH] daemon: improve internal commandrvf
...ignore_value (open ("/dev/null", O_RDONLY|O_CLOEXEC)); + /* Set stdin to /dev/null. */ + if (open ("/dev/null", O_RDONLY) == -1) { + perror ("open(/dev/null)"); + _exit (EXIT_FAILURE); + } } close (so_fd[PIPE_READ]); close (se_fd[PIPE_READ]); - if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) - dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO); - else - dup2 (se_fd[PIPE_WRITE], STDOUT_FILENO); - dup2 (se_fd[PIPE_WRITE], STDERR_FILENO); + if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) { + if (d...
2015 Dec 02
0
Re: [PATCH] daemon: improve internal commandrvf
...ot;, O_RDONLY|O_CLOEXEC)); > + /* Set stdin to /dev/null. */ > + if (open ("/dev/null", O_RDONLY) == -1) { > + perror ("open(/dev/null)"); > + _exit (EXIT_FAILURE); > + } > } > close (so_fd[PIPE_READ]); > close (se_fd[PIPE_READ]); > - if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) > - dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO); > - else > - dup2 (se_fd[PIPE_WRITE], STDOUT_FILENO); > - dup2 (se_fd[PIPE_WRITE], STDERR_FILENO); > + if (!(flags & COMMAND_FLAG_FOLD_STD...
2016 Jan 26
1
[PATCH] daemon: improve debugging for "stdout on stderr" flag
...mon/command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/command.c b/daemon/command.c index 73fce56..2423a4e 100644 --- a/daemon/command.c +++ b/daemon/command.c @@ -185,6 +185,7 @@ commandrvf (char **stdoutput, char **stderror, unsigned flags, int so_fd[2], se_fd[2]; unsigned flag_copy_stdin = flags & COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN; int flag_copy_fd = (int) (flags & COMMAND_FLAG_FD_MASK); + unsigned flag_out_on_err = flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR; pid_t pid; int r, quit, i; fd_set rset, rset2; @@ -196,7 +197,...
2016 Jan 21
8
[PATCH v3 0/6] [FOR COMMENTS ONLY] Rework inspection.
For background on this change, see: https://rwmj.wordpress.com/2015/12/06/inspection-now-with-added-prolog/ v2 was previously posted here: https://www.redhat.com/archives/libguestfs/2015-December/msg00038.html To test this patch series on a real guest, you can do: $ ./run guestfish -v -x -a /var/tmp/centos-6.img ><fs> run ><fs> debug sh "guestfs-inspection
2015 Dec 05
6
[PATCH 0/6 v2] [FOR COMMENTS ONLY] Rework inspection.
This is a more working version. Inspection (partially) succeeds on a real guest this time :-) You can test it out on a real guest (in this case, a CentOS disk image located at /tmp/centos-6.img) by doing: $ ./run guestfish -v -x -a /tmp/centos-6.img ><fs> run ><fs> debug sh "guestfs-inspection --verbose" which will print lots of debugging, and at the end the
2009 Nov 09
1
[PATCH libguestfs] indent with spaces, not TABs
...stfsd.c +++ b/daemon/guestfsd.c @@ -641,7 +641,7 @@ commandvf (char **stdoutput, char **stderror, int flags, */ int commandrvf (char **stdoutput, char **stderror, int flags, - char const* const *argv) + char const* const *argv) { int so_size = 0, se_size = 0; int so_fd[2], se_fd[2]; @@ -746,19 +746,19 @@ commandrvf (char **stdoutput, char **stderror, int flags, if (r == 0) { FD_CLR (se_fd[0], &rset); quit++; } if (r > 0) { - if (verbose) - ignore_value (write (2, buf, r)); - - if (stderror) { - se_size += r; - p = realloc (*stderror, se_size); -...
2011 Jun 09
15
[PATCH 00/13] Fix errors found using Coverity static analyzer.
I ran the Coverity static analyzer[1] on libguestfs, and fixed many errors as a result. Coverity found some errors in gnulib, but it doesn't seem to be worth following those up since the version of gnulib we are using is so old. There are a couple more errors (possibly 1 false-positive) which I'm going to send in a separate email. BTW all the errors found by Coverity were in the daemon
2012 Dec 13
1
[PATCH] daemon: fix directory outside current root when executing commands
...ts /tests/c-api/tests.c /tests/c-api/test*.tmp diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 7e83a2a..1cbf82c 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -846,6 +846,8 @@ commandrvf (char **stdoutput, char **stderror, int flags, close (so_fd[PIPE_WRITE]); close (se_fd[PIPE_WRITE]); + chdir("/"); + execvp (argv[0], (void *) argv); perror (argv[0]); _exit (EXIT_FAILURE); diff --git a/generator/actions.ml b/generator/actions.ml index 2e815fc..f78d851 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -3687,7 +3687,12 @@ C&...
2009 Aug 17
13
total warning-removal for daemon/
The warnings in daemon were aggravating and risky for development (too easy to miss new ones) so I spent some time last week and today working on removing them. The first patch gets us down to almost no warnings with the original -Wall setting. That was by far the hardest part. Once I'd done that, I enabled nearly all of gcc's warnings via gnulib's warnings and manywarnings modules
2012 Mar 13
2
[PATCH 0/2] 'int' to 'size_t' changes
These two patches are probably not completely independent, but separating them is a lot of work. With *both* patches applied, all the tests and extra-tests pass. That's no guarantee however that there isn't a mistake, so I don't think this patch is a candidate for the 1.16 branch, until it's had a lot more testing in development. Rich.
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
..._size - r, buf, r); + so_size += r; + p = realloc (*stdoutput, so_size); + if (p == NULL) { + perror ("realloc"); + goto quit; + } + *stdoutput = p; + memcpy (*stdoutput + so_size - r, buf, r); } } if (FD_ISSET (se_fd[0], &rset2)) { /* something on stderr */ r = read (se_fd[0], buf, sizeof buf); if (r == -1) { - perror ("read"); - goto quit; + perror ("read"); + goto quit; } if (r == 0) { FD_CLR (se_fd[0], &rset); quit++; } if (r >...