RE: [Refdb-users] refdbc and php4
Status: Beta
Brought to you by:
mhoenicka
|
From: Markus H. <mar...@mh...> - 2003-02-12 23:04:15
|
Alan,
could you please test the following patch in addition to the one I
sent previously? Let me know whether it fixes your problem.
Markus Hoenicka writes:
> Hi Alan,
>
> I just found out that it indeed makes a difference. When I run my test
> script as a CGI app, it reports that stdin is not connected to a
> tty. Under these circumstances, refdbc will try to read from stdin and
> fail with the messages that you reported. I'll try and see whether
> there is a clean fix for this problem.
diff -c -r1.45 refdbc.c
*** refdbc.c 6 Feb 2003 22:12:46 -0000 1.45
--- refdbc.c 12 Feb 2003 22:57:11 -0000
***************
*** 193,198 ****
--- 193,199 ----
int n_opt, i, j;
int n_readinit = 1; /* if 1, read config file. If 0, skip config file */
int retval;
+ int n_cgi_env = 0; /* will be 1 if started in a CGI environment */
FILE* errstream;
#ifdef REFDB_CGI
struct liliform sentinel;
***************
*** 207,212 ****
--- 208,214 ----
/* test how we were invoked */
#ifdef REFDB_CGI
n_cgi = is_cgi(&request_method, &content_length, delayed_cgi_errmsg); /* 1 if we are running as a cgi app */
+ n_cgi_env = n_cgi;
/* look for batch command. If found, set n_cgi to 0 because we are
apparently invoked as a regular app by a CGI app */
***************
*** 227,233 ****
errstream = stderr;
}
! if (!isatty(fileno(stdin))) { /* if we receive data on stdin via a redirection or a pipe */
n_read_stdin = 1;
}
--- 229,239 ----
errstream = stderr;
}
! /* switch on reading from stdin if we receive data on stdin via a
! redirection or a pipe. If refdbc is started from a CGI app as a
! regular app, it will still think that stdin is not connected to a
! tty. In that case we must not try to read from stdin */
! if (!isatty(fileno(stdin)) && !n_cgi_env) {
n_read_stdin = 1;
}
--
Markus Hoenicka
mar...@ca...
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de
|