summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fb6a9f9)
raw | patch | inline | side by side (parent: fb6a9f9)
author | Paul T Darga <pdarga@umich.edu> | |
Thu, 8 Jun 2006 18:14:47 +0000 (14:14 -0400) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 8 Jun 2006 18:57:00 +0000 (11:57 -0700) |
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>
Signed-off-by: Paul T Darga <pdarga@umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
connect.c | patch | blob | history | |
imap-send.c | patch | blob | history | |
rsh.c | patch | blob | history |
diff --git a/connect.c b/connect.c
index eca94f75485ecf6ac585e3e6c8d12f7978b24f06..52d709e58d53f053ec00bfb9f31501684cbaf0e5 100644 (file)
--- a/connect.c
+++ b/connect.c
if (pipe(pipefd[0]) < 0 || pipe(pipefd[1]) < 0)
die("unable to create pipe pair for communication");
pid = fork();
+ if (pid < 0)
+ die("unable to fork");
if (!pid) {
snprintf(command, sizeof(command), "%s %s", prog,
sq_quote(path));
diff --git a/imap-send.c b/imap-send.c
index 52e2400b57118e7f9a27c85212e1c539d16add7c..285ad29afb4c4126010ddc2f76963b4f8f1cce70 100644 (file)
--- a/imap-send.c
+++ b/imap-send.c
struct hostent *he;
struct sockaddr_in addr;
int s, a[2], preauth;
+ pid_t pid;
ctx = xcalloc( sizeof(*ctx), 1 );
exit( 1 );
}
- if (fork() == 0) {
+ pid = fork();
+ if (pid < 0)
+ _exit( 127 );
+ if (!pid) {
if (dup2( a[0], 0 ) == -1 || dup2( a[0], 1 ) == -1)
_exit( 127 );
close( a[0] );
index d66526941fbe45f99e51babc2c55a63b4baa027c..07166addd9629675c4b0c7c065564a283014b69d 100644 (file)
--- a/rsh.c
+++ b/rsh.c
int sizen;
int of;
int i;
+ pid_t pid;
if (!strcmp(url, "-")) {
*fd_in = 0;
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";