Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2003 05:10:13 -0700 (PDT)
From:      "KAREN THODE" <thode12@msn.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   bin/5296
Message-ID:  <200305221210.h4MCADhe045777@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/5296; it has been noted by GNATS.

From: "KAREN THODE" <thode12@msn.com>
To: <freebsd-gnats-submit@freebsd.org>
Cc:  
Subject: bin/5296
Date: Thu, 22 May 2003 07:05:43 -0500

 ------=_NextPart_001_0000_01C32030.8F63FE80
 Content-Type: text/plain; charset="iso-8859-1"
 
 Here is another way to create the pidfile (or any file, for that matter):
 
 int create(char *path)
 {
      int fd;
      
      if((fd=open(path, CREATE|EXCL|WRONLY, READ|WRITE)) == -1)
      {
           return(0);
      }
      close(fd);
      return(1);
 }
 
 Note that create() returns a 1 on success and a 0 on failure.
 
 Lucas
 ------=_NextPart_001_0000_01C32030.8F63FE80
 Content-Type: text/html; charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 <HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Here is anothe=
 r way to create the pidfile (or any file, for that matter):</DIV> <DIV>&n=
 bsp;</DIV> <DIV>int&nbsp;create(char *path)</DIV> <DIV>{</DIV> <DIV>&nbsp=
 ;&nbsp;&nbsp;&nbsp; int fd;</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; </DIV> <D=
 IV>&nbsp;&nbsp;&nbsp;&nbsp; if((fd=3Dopen(path, CREATE|EXCL|WRONLY, READ|=
 WRITE)) =3D=3D -1)</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; {</DIV> <DIV>&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return(0);</DIV> <DIV>&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; close(=
 fd);</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; return(1);</DIV> <DIV>}</DIV> <D=
 IV>&nbsp;</DIV> <DIV>Note that create() returns a 1 on success and a 0 on=
  failure.</DIV> <DIV>&nbsp;</DIV> <DIV>Lucas<BR><BR></DIV></BODY></HTML>
 
 ------=_NextPart_001_0000_01C32030.8F63FE80--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305221210.h4MCADhe045777>