Fossil SCM

Put the output into CGI or inetd mode prior to failing with a "file-descriptor 2 not open" error.

drh 2015-02-07 20:40 trunk
Commit 35ab16bc9e0f33154a1a7464a8edf3c85e11fd5b
1 file changed +3
+3
--- src/main.c
+++ src/main.c
@@ -693,10 +693,13 @@
693693
#ifndef _WIN32
694694
/* Make sure open() will not return file descriptor 2. */
695695
{ int nTry = 0;
696696
while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>=0 ){}
697697
if( !is_valid_fd(2) ){
698
+ g.cgiOutput = 1;
699
+ g.httpOut = stdout;
700
+ g.fullHttpReply = !g.isHTTP;
698701
fossil_fatal("file descriptor 2 is not open");
699702
}
700703
}
701704
#endif
702705
rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
703706
--- src/main.c
+++ src/main.c
@@ -693,10 +693,13 @@
693 #ifndef _WIN32
694 /* Make sure open() will not return file descriptor 2. */
695 { int nTry = 0;
696 while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>=0 ){}
697 if( !is_valid_fd(2) ){
 
 
 
698 fossil_fatal("file descriptor 2 is not open");
699 }
700 }
701 #endif
702 rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
703
--- src/main.c
+++ src/main.c
@@ -693,10 +693,13 @@
693 #ifndef _WIN32
694 /* Make sure open() will not return file descriptor 2. */
695 { int nTry = 0;
696 while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>=0 ){}
697 if( !is_valid_fd(2) ){
698 g.cgiOutput = 1;
699 g.httpOut = stdout;
700 g.fullHttpReply = !g.isHTTP;
701 fossil_fatal("file descriptor 2 is not open");
702 }
703 }
704 #endif
705 rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
706

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button