aboutsummaryrefslogtreecommitdiff
path: root/rsh.c
diff options
context:
space:
mode:
authorPaul T Darga <pdarga@umich.edu>2006-06-08 14:14:47 -0400
committerJunio C Hamano <junkio@cox.net>2006-06-08 11:57:00 -0700
commitc9bc159d7f41e2916830b05529c1ce06a81d975f (patch)
treedd3d17965ec8c97357f0a15d97455f0f4c6b30be /rsh.c
parentfb6a9f93d39e4e5fdb83673a927f71a34e9fb7c0 (diff)
downloadgit-c9bc159d7f41e2916830b05529c1ce06a81d975f.tar.gz
git-c9bc159d7f41e2916830b05529c1ce06a81d975f.tar.xz
check for error return from fork()
Trivial fixup for fork() callsites which do not check for errors. Signed-off-by: Paul T Darga <pdarga@umich.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'rsh.c')
-rw-r--r--rsh.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rsh.c b/rsh.c
index d66526941..07166addd 100644
--- a/rsh.c
+++ b/rsh.c
@@ -48,6 +48,7 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
int sizen;
int of;
int i;
+ pid_t pid;
if (!strcmp(url, "-")) {
*fd_in = 0;
@@ -91,7 +92,10 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
return error("Couldn't create socket");
- if (!fork()) {
+ pid = fork();
+ if (pid < 0)
+ return error("Couldn't fork");
+ if (!pid) {
const char *ssh, *ssh_basename;
ssh = getenv("GIT_SSH");
if (!ssh) ssh = "ssh";