aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_wrappers.c
diff options
context:
space:
mode:
authorPeter Seebach <seebs@eee12.(none)>2010-04-30 13:01:58 -0500
committerPeter Seebach <seebs@eee12.(none)>2010-04-30 17:54:27 -0500
commitef956b579ede73770a2212a1888111b26986a637 (patch)
treed45288b240d5c01c65a72834efe379903abe38bf /pseudo_wrappers.c
parent0bc0b5a7f6eecb6bc129b1ab3b35d69f93c9e7a4 (diff)
downloadpseudo-ef956b579ede73770a2212a1888111b26986a637.tar.gz
pseudo-ef956b579ede73770a2212a1888111b26986a637.tar.bz2
pseudo-ef956b579ede73770a2212a1888111b26986a637.zip
Improve PSEUDO_DEBUG_FILE.
The PSEUDO_DEBUG_FILE feature is enhanced, and is now also used by the pseudo server.
Diffstat (limited to 'pseudo_wrappers.c')
-rw-r--r--pseudo_wrappers.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index 041a2f5..ae4e698 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -121,7 +121,6 @@ pseudo_populate_wrappers(void) {
char *debug;
static int done = 0;
char *pseudo_path = 0;
- int fd;
if (done)
return done;
@@ -150,29 +149,9 @@ pseudo_populate_wrappers(void) {
pseudo_debug_verbose();
}
}
- if (getenv("PSEUDO_DEBUG_FILE")) {
- char filebuf[pseudo_path_max()], *fmt = getenv("PSEUDO_DEBUG_FILE");
- char *name, *pid;
- name = strstr(fmt, "%s");
- pid = strstr(fmt, "%d");
- if (name && pid) {
- if (name > pid) {
- snprintf(filebuf, pseudo_path_max(), fmt, getpid(), program_invocation_short_name);
- } else {
- snprintf(filebuf, pseudo_path_max(), fmt, program_invocation_short_name, getpid());
- }
- } else if (name) {
- snprintf(filebuf, pseudo_path_max(), fmt, program_invocation_short_name);
- } else if (pid) {
- snprintf(filebuf, pseudo_path_max(), fmt, getpid());
- } else {
- snprintf(filebuf, pseudo_path_max(), "%s", fmt);
- }
- fd = open(filebuf, O_WRONLY | O_APPEND | O_CREAT, 0644);
- if (fd >= 0) {
- pseudo_util_debug_fd = fd;
- }
- }
+ /* if PSEUDO_DEBUG_FILE is set up, redirect logging there.
+ */
+ pseudo_logfile(NULL);
/* must happen after wrappers are set up, because it can call
* getcwd(), which needs wrappers, but must happen here so that
* any attempt to use a path in a wrapper function will have a