Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Message-ID: <007f01bfed33$65263120$f7c723cb@lifelesswks> From: "Robert Collins" To: "cygapp" Subject: syslog access violation Date: Fri, 14 Jul 2000 11:32:35 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Hi everyone, I posted a week or so about a problem with daemon (squid), when it closed fd(2). I've tracked that down a bit more as there were remaining problems, and found that fd(1) and fd(2) can't be closed by the daemon or syslog dies, either that or something called by syslog. I haven't got gdb attaching to the daemon properly yet so I have been // code lines.. arghh... The question is: Looking through syslog.cc, debug_printf is used quite a bit. Does this write to fd 1 or 2? Call me silly but I can't find the code for debug_printf to check myself... I wrote a test package that does a similar call sequence to the daemon, but it doesn't stackdump or access violate, so I assume it must be a combination of other activies undertaken by the child process... #include #include int main (int argc, char **argv) { int i; int pid,status; openlog("testparent", LOG_PID | LOG_NDELAY | LOG_CONS, LOG_LOCAL4); if ((pid = fork()) < 0) syslog(LOG_ALERT, "fork failed: %m"); else if (pid > 0) exit(0); closelog(); for(i=0;i<8192;i++) close(i); if ((pid=fork()) == 0){ openlog("test",LOG_PID|LOG_NDELAY|LOG_CONS, LOG_LOCAL4); syslog(LOG_ALERT,"syslog call from test"); } openlog("test",LOG_PID|LOG_NDELAY|LOG_CONS, LOG_LOCAL4); syslog(LOG_ALERT,"syslog call from test"); pid=waitpid(-1,&status,0); syslog(LOG_ALERT,"syslog call from test"); return 0; }