Skip to content

Commit

Permalink
Merge branch 'sp/maint-http-backend-die-triggers-die-recursively'
Browse files Browse the repository at this point in the history
* sp/maint-http-backend-die-triggers-die-recursively:
  http-backend: Don't infinite loop during die()
  • Loading branch information
Junio C Hamano committed Apr 3, 2010
2 parents 9b5a7c4 + 5856b5f commit 7b1cb5c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions http-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,19 @@ static void service_rpc(char *service_name)

static NORETURN void die_webcgi(const char *err, va_list params)
{
char buffer[1000];
static int dead;

http_status(500, "Internal Server Error");
hdr_nocache();
end_headers();
if (!dead) {
char buffer[1000];
dead = 1;

vsnprintf(buffer, sizeof(buffer), err, params);
fprintf(stderr, "fatal: %s\n", buffer);
exit(0);
vsnprintf(buffer, sizeof(buffer), err, params);
fprintf(stderr, "fatal: %s\n", buffer);
http_status(500, "Internal Server Error");
hdr_nocache();
end_headers();
}
exit(0); /* we successfully reported a failure ;-) */
}

static char* getdir(void)
Expand Down

0 comments on commit 7b1cb5c

Please sign in to comment.