X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=rsh.c;h=07166addd9629675c4b0c7c065564a283014b69d;hb=ae448e3854d8b6e7e37aa88fa3917f5dd97f3210;hp=d66526941fbe45f99e51babc2c55a63b4baa027c;hpb=d9ad59e7636d98daa6131e9fd2cb2b4f5745a853;p=git.git diff --git a/rsh.c b/rsh.c index d6652694..07166add 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";