gitweb: No error messages with unescaped/unprotected user input
[gitweb.git] / rsh.c
diff --git a/rsh.c b/rsh.c
index 64c48091cb32af1d8c5b2ec145ad660ab9f0a75f..07166addd9629675c4b0c7c065564a283014b69d 100644 (file)
--- 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;
@@ -68,7 +69,7 @@ int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
        if (!path) {
                return error("Bad URL: %s", url);
        }
-       /* $GIT_RSH <host> "env GIR_DIR=<path> <remote_prog> <args...>" */
+       /* $GIT_RSH <host> "env GIT_DIR=<path> <remote_prog> <args...>" */
        sizen = COMMAND_SIZE;
        posn = command;
        of = 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";