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>
This commit is contained in:
Paul T Darga
2006-06-08 14:14:47 -04:00
committed by Junio C Hamano
parent fb6a9f93d3
commit c9bc159d7f
3 changed files with 12 additions and 2 deletions

6
rsh.c
View File

@ -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";