lib/util: add samba_runcmd_export_stdin() helper function
authorStefan Metzmacher <metze@samba.org>
Sat, 2 Feb 2019 11:58:57 +0000 (12:58 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 7 Feb 2019 21:47:22 +0000 (22:47 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/util/samba_util.h
lib/util/util_runcmd.c

index 7b96a595d437a3d9494a1c6733d38052dc4d113b..1cd1235f8f113952f3df97e818245bb8ef04e87d 100644 (file)
@@ -649,6 +649,7 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
                                     int stderr_log_level,
                                     const char * const *argv0, ...);
 int samba_runcmd_recv(struct tevent_req *req, int *perrno);
+int samba_runcmd_export_stdin(struct tevent_req *req);
 
 #ifdef DEVELOPER
 void samba_start_debugger(void);
index 42d84a895bf21aa11381ea1b1c3e5763d9123abe..78ac77f4946737d6ee4e6bdaab58b35a1b9f2413 100644 (file)
@@ -49,6 +49,17 @@ static void samba_runcmd_cleanup_fn(struct tevent_req *req,
        }
 }
 
+int samba_runcmd_export_stdin(struct tevent_req *req)
+{
+       struct samba_runcmd_state *state = tevent_req_data(req,
+                                          struct samba_runcmd_state);
+       int ret = state->fd_stdin;
+
+       state->fd_stdin = -1;
+
+       return ret;
+}
+
 static void samba_runcmd_io_handler(struct tevent_context *ev,
                                    struct tevent_fd *fde,
                                    uint16_t flags,