Displaying 12 results from an estimated 12 matches for "pipe_write".
2012 Dec 13
2
[PATCH 1/2] daemon: NFC Use symbolic names in commandrvf
Improve readability of commandrvf() by replacing bare int values for
file descriptors with their symbolic names STD{IN,OUT,ERR}_FILENO.
Also add PIPE_READ and PIPE_WRITE for referencing relevant ends of a pipe.
---
daemon/guestfsd.c | 79 +++++++++++++++++++++++++++++--------------------------
1 file changed, 42 insertions(+), 37 deletions(-)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 5c84849..4b3dd5f 100644
--- a/daemon/guestfsd.c
+++ b/daemon/gues...
2015 Dec 02
3
[PATCH] daemon: improve internal commandrvf
...l. */
+ 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 (dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO) == -1) {
+ perror ("dup2/so_fd[PIPE_WRITE]");
+...
2015 Dec 02
0
Re: [PATCH] daemon: improve internal commandrvf
...uot;, 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 (dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO) == -1) {
> + perror ("du...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...+#include "command.h"
+#include "cleanups.h"
+
+extern int verbose;
+
+extern const char *sysroot;
+extern size_t sysroot_len;
+
+#ifndef MAX
+# define MAX(a,b) ((a)>(b)?(a):(b))
+#endif
+
+/* For improved readability dealing with pipe arrays */
+#define PIPE_READ 0
+#define PIPE_WRITE 1
+
+/* Easy ways to run external commands. For full documentation, see
+ * 'commandrvf' below.
+ */
+int
+commandf (char **stdoutput, char **stderror, unsigned flags,
+ const char *name, ...)
+{
+ va_list args;
+ /* NB: Mustn't free the strings which are on the stack. */
+...
2016 Jan 26
1
[PATCH] daemon: improve debugging for "stdout on stderr" flag
...r (i = 1; argv[i] != NULL; ++i) {
@@ -261,7 +263,7 @@ commandrvf (char **stdoutput, char **stderror, unsigned flags,
}
close (so_fd[PIPE_READ]);
close (se_fd[PIPE_READ]);
- if (!(flags & COMMAND_FLAG_FOLD_STDOUT_ON_STDERR)) {
+ if (!flag_out_on_err) {
if (dup2 (so_fd[PIPE_WRITE], STDOUT_FILENO) == -1) {
perror ("dup2/so_fd[PIPE_WRITE]");
_exit (EXIT_FAILURE);
--
2.5.0
2013 Aug 18
3
missing chdir before chroot in guestfsd
...gt; sh "cd / ; /bin/pwd"
/
This untested change may fix it.
===================
--- libguestfs-1.20.10.orig/daemon/guestfsd.c
+++ libguestfs-1.20.10/daemon/guestfsd.c
@@ -879,7 +879,11 @@ commandrvf (char **stdoutput, char **std
close (stdin_fd[PIPE_READ]);
close (stdin_fd[PIPE_WRITE]);
- if (chroot (sysroot) == -1) {
+ if (chdir (sysroot) == -1) {
+ perror ("chdir");
+ _exit (EXIT_FAILURE);
+ }
+ if (chroot (".") == -1) {
perror ("chroot");
_exit (EXIT_FAILURE);
}
Olaf
2013 May 23
2
Problem with btrfs send/receive
Hi everyone,
I was trying the new send/receive feature today but can''t make it work.
These are the commands I was using:
btrfs subvol snap -r /mnt/data1/@downloads/ /mnt/data1/snapshots/testsnap
btrfs send /mnt/data1/snapshots/testsnap | btrfs receive
/mnt/data1/snapshots/testreceive/
This command never finishes. A ''ls /mnt/data1/snapshots/testreceive/ ''
never
2012 Dec 13
1
[PATCH] daemon: fix directory outside current root when executing commands
...test-pwd
/tests/c-api/tests
/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
@@ -...
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
2013 Aug 19
0
Re: missing chdir before chroot in guestfsd
...t; This untested change may fix it.
>
> ===================
> --- libguestfs-1.20.10.orig/daemon/guestfsd.c
> +++ libguestfs-1.20.10/daemon/guestfsd.c
> @@ -879,7 +879,11 @@ commandrvf (char **stdoutput, char **std
> close (stdin_fd[PIPE_READ]);
> close (stdin_fd[PIPE_WRITE]);
>
> - if (chroot (sysroot) == -1) {
> + if (chdir (sysroot) == -1) {
> + perror ("chdir");
> + _exit (EXIT_FAILURE);
> + }
> + if (chroot (".") == -1) {
> perror ("chroot");
> _exit (EX...
2006 May 12
0
kernel crash
...15:34:18 ioana.slack.i kernel: [<c012017e>] copy_process+0x709/0xd4f
May 12 15:34:18 ioana.slack.i kernel: [<c01879b4>] inode_update_time+0x80/0x87
May 12 15:34:18 ioana.slack.i kernel: [<c01208bd>] do_fork+0x9b/0x1a5
May 12 15:34:18 ioana.slack.i kernel: [<c0176f9b>] pipe_write+0x1c/0x20
May 12 15:34:18 ioana.slack.i kernel: [<c0168d21>] vfs_write+0xda/0xe2
May 12 15:34:18 ioana.slack.i kernel: [<c0104923>] sys_clone+0x22/0x26
May 12 15:34:18 ioana.slack.i kernel: [<c0311443>] syscall_call+0x7/0xb
May 12 15:34:18 ioana.slack.i kernel: Code: 01 00...
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