The following reply was made to PR bin/153362; it has been noted by GNATS.

From: "Joe Holden" <[email protected]>
To: <[email protected]>,
        <[email protected]>
Cc:  
Subject: Re: bin/153362: [patch] add -p flag to set pidfile for rtadvd(8)
Date: Wed, 22 Dec 2010 16:07:36 -0000

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0020_01CBA1F2.59A8E6B0
 Content-Type: multipart/alternative;
        boundary="----=_NextPart_001_0021_01CBA1F2.59A8E6B0"
 
 
 ------=_NextPart_001_0021_01CBA1F2.59A8E6B0
 Content-Type: text/plain;
        charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 Fixed if/else ordering, only try and unlink pidfile if pidfp is set...
 
 Ta,
 J
 ------=_NextPart_001_0021_01CBA1F2.59A8E6B0
 Content-Type: text/html;
        charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>
 <META content=3D"text/html; charset=3Diso-8859-1" =
 http-equiv=3DContent-Type>
 <META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18999">
 <STYLE></STYLE>
 </HEAD>
 <BODY bgColor=3D#ffffff>
 <DIV><FONT size=3D2 face=3DArial>Fixed if/else ordering, only try and =
 unlink pidfile=20
 if pidfp is set...</FONT></DIV>
 <DIV><FONT size=3D2 face=3DArial></FONT>&nbsp;</DIV>
 <DIV><FONT size=3D2 face=3DArial>Ta,</FONT></DIV>
 <DIV><FONT size=3D2 face=3DArial>J</FONT></DIV></BODY></HTML>
 
 ------=_NextPart_001_0021_01CBA1F2.59A8E6B0--
 
 ------=_NextPart_000_0020_01CBA1F2.59A8E6B0
 Content-Type: application/octet-stream;
        name="rtadvd-releng8.patch"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment;
        filename="rtadvd-releng8.patch"
 
 diff -ur rtadvd.orig/rtadvd.8 rtadvd/rtadvd.8=0A=
 --- rtadvd.orig/rtadvd.8       2010-12-22 01:32:38.000000000 +0000=0A=
 +++ rtadvd/rtadvd.8    2010-12-22 01:22:15.000000000 +0000=0A=
 @@ -144,6 +144,8 @@=0A=
  .It Fl s=0A=
  Do not add or delete prefixes dynamically.=0A=
  Only statically configured prefixes, if any, will be advertised.=0A=
 +.It Fl p=0A=
 +Set an alternate pidfile location.=0A=
  .El=0A=
  .Pp=0A=
  Upon receipt of signal=0A=
 diff -ur rtadvd.orig/rtadvd.c rtadvd/rtadvd.c=0A=
 --- rtadvd.orig/rtadvd.c       2010-12-22 01:32:38.000000000 +0000=0A=
 +++ rtadvd/rtadvd.c    2010-12-22 16:04:22.000000000 +0000=0A=
 @@ -81,6 +81,7 @@=0A=
  struct in6_addr in6a_site_allrouters;=0A=
  static char *dumpfilename =3D "/var/run/rtadvd.dump"; /* XXX: should be =
 configurable */=0A=
  static char *pidfilename =3D "/var/run/rtadvd.pid"; /* should be =
 configurable */=0A=
 +char *pidfilecust;=0A=
  static char *mcastif;=0A=
  int sock;=0A=
  int rtsock =3D -1;=0A=
 @@ -163,7 +164,7 @@=0A=
        pid_t pid;=0A=
  =0A=
        /* get command line options and arguments */=0A=
 -      while ((ch =3D getopt(argc, argv, "c:dDfM:Rs")) !=3D -1) {=0A=
 +      while ((ch =3D getopt(argc, argv, "c:dDfMp:Rs")) !=3D -1) {=0A=
                switch (ch) {=0A=
                case 'c':=0A=
                        conffile =3D optarg;=0A=
 @@ -189,13 +190,16 @@=0A=
                case 's':=0A=
                        sflag =3D 1;=0A=
                        break;=0A=
 +              case 'p':=0A=
 +                      pidfilecust =3D optarg;=0A=
 +                      break;=0A=
                }=0A=
        }=0A=
        argc -=3D optind;=0A=
        argv +=3D optind;=0A=
        if (argc =3D=3D 0) {=0A=
                fprintf(stderr,=0A=
 -                      "usage: rtadvd [-dDfMRs] [-c conffile] "=0A=
 +                      "usage: rtadvd [-dDfMRsp] [-c conffile] "=0A=
                        "interfaces...\n");=0A=
                exit(1);=0A=
        }=0A=
 @@ -241,13 +245,24 @@=0A=
  =0A=
        /* record the current PID */=0A=
        pid =3D getpid();=0A=
 -      if ((pidfp =3D fopen(pidfilename, "w")) =3D=3D NULL) {=0A=
 -              syslog(LOG_ERR,=0A=
 -                  "<%s> failed to open the pid log file, run anyway.",=0A=
 -                  __func__);=0A=
 -      } else {=0A=
 -              fprintf(pidfp, "%d\n", pid);=0A=
 -              fclose(pidfp);=0A=
 +      if (!pidfilecust) {=0A=
 +              if ((pidfp =3D fopen(pidfilename, "w")) =3D=3D NULL) {=0A=
 +                      syslog(LOG_ERR,=0A=
 +                      "<%s> failed to open the pid log file, run anyway.",=0A=
 +                      __func__);=0A=
 +              } else {=0A=
 +                      fprintf(pidfp, "%d\n", pid);=0A=
 +                      fclose(pidfp);=0A=
 +              }=0A=
 +      } else {                        =0A=
 +              if ((pidfp =3D fopen(pidfilecust, "w")) =3D=3D NULL) {=0A=
 +                      syslog(LOG_ERR,=0A=
 +                      "<%s> failed to open the pid log file, run anyway.",=0A=
 +                      __func__);=0A=
 +              } else {=0A=
 +                      fprintf(pidfp, "%d\n", pid);=0A=
 +                      fclose(pidfp);=0A=
 +              }=0A=
        }=0A=
  =0A=
  #ifdef HAVE_POLL_H=0A=
 @@ -297,6 +312,10 @@=0A=
                }=0A=
  =0A=
                if (do_die) {=0A=
 +                      if (pidfp)      {=0A=
 +                              /* unlink() pid file before exiting... */=0A=
 +                              if (!pidfilecust)       {       
unlink(pidfilename); } else {   =
 unlink(pidfilecust); }=0A=
 +                      }=0A=
                        die();=0A=
                        /*NOTREACHED*/=0A=
                }=0A=
 
 ------=_NextPart_000_0020_01CBA1F2.59A8E6B0--
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to