bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] [PATCH] create pidfile in inetd


From: Alain Magloire
Subject: Re: [bug-inetutils] [PATCH] create pidfile in inetd
Date: Fri, 12 Sep 2003 10:27:27 -0400 (EDT)

> 
> On Thu, Aug 28, 2003 at 08:37:41PM +0000, Robert Millan wrote:
> > On Thu, Aug 28, 2003 at 07:46:27PM +0000, Robert Millan wrote:
> > > 
> > > Hi!
> > > 
> > > This patch fixes inetd to create its corresponding pidfile in
> > > /var/run/inetd.pid. It uses the PATH_INETPID macro, and defines
> > > it in "paths". (thanks Jeroen for your tips)
> > 
> > Shame on me, I forgot the patch. Well here is it.
> 
> I made some fixes to the patch, thanks to Jeroen and others who pointed
> the bugs:
> 
>  - fp is *FILE not int
>  - put the fp declaration into braces to be compliant with pre-c99 compilers
>  - replacing fprintf with syslog, since writing to stderr has no effect
>  - the macro should be PATH_INETDPID rather than PATH_INETPID for consistency
> 

Bonjour Robert,

        Sorry for the long delay, I'm justing getting though my old emails.

The patch for inetd is incomplete, I do not think it was apply on the 
repository.

Problem:
        - You do not delete the pidfile.

More general problems:
        - It seems we have inconsistency on where the pidfiles are created.
          Syslog is localstatedir, others or sysconfdir
        - The inetd signal handlers are doing way to much and some functions
          are not signal-safe and should never be call in signal handlers.
          We need to move the code outside the handlers.

To go back to your patch, you/we need to create the file and also delete the
file when inetd is going down.

> diff -ur inetutils-20030703.old/inetd/inetd.c inetutils-20030703/inetd/inetd.c
> --- inetutils-20030703.old/inetd/inetd.c      2002-04-29 21:02:54.000000000 
> +0000
> +++ inetutils-20030703/inetd/inetd.c  2003-08-29 13:36:07.000000000 +0000
> @@ -359,6 +359,16 @@
>  
>    openlog ("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
>  
> +  { FILE *fp = fopen ("PATH_INETDPID", "w");
> +  if (fp != NULL)
> +    {
> +      fprintf (fp, "%d\n", getpid ());
> +      (void) fclose (fp);
> +    }
> +  else
> +    syslog (LOG_CRIT, "can't open PATH_INETDPID: %s\n", strerror (errno));
> +  }
> +
>  #if defined(HAVE_SIGACTION)
>    {
>      struct sigaction sa;
> diff -ur inetutils-20030703.old/paths inetutils-20030703/paths
> --- inetutils-20030703.old/paths      2001-06-13 16:46:42.000000000 +0000
> +++ inetutils-20030703/paths  2003-08-29 13:30:05.000000000 +0000
> @@ -82,6 +82,7 @@
>  PATH_FTPDPID $(localstatedir)/run/ftpd.pid
>  PATH_INETDCONF       $(sysconfdir)/inetd.conf
>  PATH_INETDDIR        $(sysconfdir)/inetd.d
> +PATH_INETDPID        $(localstatedir)/run/inetd.pid
>  PATH_UTMP    <utmp.h> <utmp.h>:UTMP_FILE $(localstatedir)/run/utmp 
> search:utmp:/var/run:/var/adm:/etc
>  PATH_UTMPX   <utmpx.h> <utmpx.h>:UTMPX_FILE $(localstatedir)/run/utmpx 
> search:utmpx:/var/run:/var/adm:/etc
>  PATH_WTMP    <utmp.h> <utmp.h>:WTMP_FILE $(localstatedir)/log/wtmp 
> search:wtmp:/var/log:/var/adm:/etc
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]