$NetBSD: patch-aa,v 1.3 2005/10/06 11:26:18 sketch Exp $ --- src/apachetop.cc.orig 2005-10-06 12:07:41.000000000 +0100 +++ src/apachetop.cc 2005-10-06 12:10:07.000000000 +0100 @@ -1104,8 +1104,16 @@ { FILE *d; va_list args; + static char tmpfile[1024] = {'\0'}; - if (cf.debug && (d = fopen(DEBUG_OUTPUT, "a"))) + if (!strlen(tmpfile)) + { + strcpy(tmpfile, "/tmp/atop.XXXXXX"); + mkdtemp(tmpfile); + strncat(tmpfile, "/debug", sizeof(tmpfile)); + } + + if (cf.debug && (d = fopen(tmpfile, "a"))) { va_start(args, fmt); vfprintf(d, fmt, args);