Hi,
Here's what I did : I wrote a small program (attached below).
In Step 1, I close stdout, and try running the program.. Since the program
doesn't have all the ap_* symbols, it complains, and the output I got was :
$ ./a
/usr/lib/dld.sl: Unresolved symbol: ap_chroot (data) from
/opt/hpws/apache/modules/mod_ssl.so
/usr/lib/dld.sl: Unresolved symbol: apr_bucket_type_flush (data) from
/opt/hpws/apache/modules/mod_ssl.so
/usr/lib/dld.sl: Unresolved symbol: unixd_config (data) from
/opt/hpws/apache/modules/mod_ssl.so
...
In Step 2, I comment close(1), and uncomment close (2), and try running the
program.. The output was :
$ ./a
Cannot load mod_ssl.so into server: Bad file number
Now, what should be the behaviour under the following scenarios :
- everything is fine : program runs fine. No problems.
- Unresolved symbols and stderr is open : program will report the
unresolved symbols on stderr
- Unresolved symbols and stderr is closed : program will exit with a -1,
with the error "Bad file number".
Question : Are you telling me that you don't like to see "Bad file number"
as the error message ?
If that is the case, can we can put a specific case for HPUX, for
1. when BIND_VERBOSE is enabled, and
2. stderr is closed, and
3. you get this message,
we can print a particular error message (because we know whatz happening)..
int main (int argc, const char * const argv[])
{
apr_pool_t *pp;
apr_status_t rv;
apr_dso_handle_t *modhandle;
apr_app_initialize(&argc, &argv, NULL);
if ((rv = apr_pool_create(&pp, NULL)) != APR_SUCCESS) {
printf("Error creating pool..\n");
apr_terminate();
exit(1);
}
apr_pool_tag (pp, "process");
close(1);
/* close (2) */
rv = apr_dso_load(&modhandle, "/opt/hpws/apache/modules/mod_ssl.so",
pp);
if (rv != APR_SUCCESS) {
char my_error[256], *err_string;
err_string = apr_pstrcat(pp, "Cannot load mod_ssl.so into server: ",
apr_dso_error(modhandle, my_error,
sizeof(my_error)),
NULL);
printf("%s", err_string);
apr_terminate();
exit(1);
}
printf("successfully loaded...\n");
}