diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-05-12 19:29:13 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-05-12 19:29:13 +0200 |
commit | 9739dae794834cf5e77ba834992710ecfc508ca5 (patch) | |
tree | e7934aff16061c14639d4b5d2a6c324e96205eed /libssh | |
parent | 81793de030e03cdaf4f6987d68219fae09022c6c (diff) | |
download | libssh-9739dae794834cf5e77ba834992710ecfc508ca5.tar.gz libssh-9739dae794834cf5e77ba834992710ecfc508ca5.tar.xz libssh-9739dae794834cf5e77ba834992710ecfc508ca5.zip |
proxycommand: check the return values of pipe().
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/socket.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libssh/socket.c b/libssh/socket.c index 935baee..b555c54 100644 --- a/libssh/socket.c +++ b/libssh/socket.c @@ -934,12 +934,21 @@ int ssh_socket_connect_proxycommand(ssh_socket s, const char *command){ socket_t in_pipe[2]; socket_t out_pipe[2]; int pid; + int rc; ssh_session session=s->session; enter_function(); if(s->state != SSH_SOCKET_NONE) return SSH_ERROR; - pipe(in_pipe); - pipe(out_pipe); + + rc = pipe(in_pipe); + if (rc < 0) { + return SSH_ERROR; + } + rc = pipe(out_pipe); + if (rc < 0) { + return SSH_ERROR; + } + pid = fork(); if(pid == 0){ ssh_execute_command(command,out_pipe[0],in_pipe[1]); |