Displaying 4 results from an estimated 4 matches for "send_stdout".
2009 Sep 11
1
[PATCH] guestfish: Redirect stdout when executing remote commands
...ive a stdout file descriptor\n");
+ }
+
+ else {
+ /* Extract the transferred file descriptor from the control data */
+ int fd = *(int *)CMSG_DATA (h);
+
+ /* Duplicate the received file descriptor to stdout */
+ dup2 (fd, STDOUT_FILENO);
+ close (fd);
+ }
+}
+
+static void
+send_stdout (int s)
+{
+ static struct cmsghdr *cmptr = NULL;
+ struct msghdr msg;
+ struct iovec iov[1];
+
+ /* Our 1 byte dummy buffer */
+ char buf[1];
+
+ /* Don't specify a destination */
+ msg.msg_name = NULL;
+ msg.msg_namelen = 0;
+
+ /* Initialise the msghdr to send ze...
2017 Mar 03
14
[PATCH 00/11] Various Coverity fixes
Hi,
this patch series fixes some issues discovered by Coverity.
Most of them are memory leaks, usually on error; there are also invalid
memory access issues.
Thanks,
Pino Toscano (11):
java: link libguestfs_jni against libutils
java: fix invalid memory access for FBuffer in struct lists
daemon: tsk: properly use GUESTFS_MAX_CHUNK_SIZE
edit: fix small memory leak on error
java: fix
2009 Nov 20
1
fix new failures from latest-from-gnulib syntax-check
...exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -88,7 +88,7 @@ receive_stdout (int s)
ssize_t n = recvmsg (s, &msg, 0);
if (n < 0) {
perror ("recvmsg stdout fd");
- exit (1);
+ exit (EXIT_FAILURE);
}
h = CMSG_FIRSTHDR(&msg);
@@ -135,7 +135,7 @@ send_stdout (int s)
cmptr = malloc (controllen);
if (NULL == cmptr) {
perror ("malloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
cmptr->cmsg_level = SOL_SOCKET;
@@ -152,7 +152,7 @@ send_stdout (int s)
if (sendmsg (s, &msg, 0) != 1) {
perror ("...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...ket */
ssize_t n = recvmsg (s, &msg, 0);
- if (n < 0) {
- perror ("recvmsg stdout fd");
- exit (EXIT_FAILURE);
- }
+ if (n < 0)
+ error (EXIT_FAILURE, errno, "recvmsg stdout fd");
h = CMSG_FIRSTHDR(&msg);
if (NULL == h) {
@@ -170,10 +165,8 @@ send_stdout (int s)
/* Initialize the control data */
if (NULL == cmptr) {
cmptr = malloc (controllen);
- if (NULL == cmptr) {
- perror ("malloc");
- exit (EXIT_FAILURE);
- }
+ if (NULL == cmptr)
+ error (EXIT_FAILURE, errno, "malloc");
}
cmptr->c...