@@ -141,12 +141,6 @@ timer_t timer; /* timer structure */
Pinfo *shmaddr; /* Start address of shared memory */
-#ifndef _LINUX
-FILE *debugfp = stderr; /* debug file pointer, used if AUSDEBUG set */
-#else
-#define debugfp stderr
-#endif
-
struct envstruct *edat = envdata; /* pointer to environment data */
/* external function declarations */
@@ -260,7 +254,7 @@ void debugout(char *fmt, ...)
if (AUSDEBUG) {
va_start(args, fmt);
- vfprintf(debugfp, fmt, args);
+ vfprintf(stderr, fmt, args);
va_end(args);
}
}
@@ -546,7 +540,12 @@ int spawn(int val)
if (!pid) { /* CHILD */
if (AUSDEBUG) {
sprintf(foo, "%sslot%d", SLOTDIR, tval);
- debugfp = fopen(foo, "a+");
+
+ if ((freopen(foo, "w", stderr)) == NULL) {
+ fprintf(stderr, "freopen(%s, w, stderr) failed: %s (%d)\n",
+ foo, strerror(errno), errno);
+ exit(1);
+ }
}
pinfo = put_proc_info(tval);