From owner-freebsd-bugs@FreeBSD.ORG Thu May 22 05:10:14 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 62BA337B401 for ; Thu, 22 May 2003 05:10:14 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0CBEB43F75 for ; Thu, 22 May 2003 05:10:14 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4MCADUp045778 for ; Thu, 22 May 2003 05:10:13 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4MCADhe045777; Thu, 22 May 2003 05:10:13 -0700 (PDT) Date: Thu, 22 May 2003 05:10:13 -0700 (PDT) Message-Id: <200305221210.h4MCADhe045777@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "KAREN THODE" Subject: bin/5296 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: KAREN THODE List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2003 12:10:14 -0000 The following reply was made to PR bin/5296; it has been noted by GNATS. From: "KAREN THODE" To: 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
Here is anothe= r way to create the pidfile (or any file, for that matter):
&n= bsp;
int create(char *path)
{
 = ;    int fd;
    
     if((fd=3Dopen(path, CREATE|EXCL|WRONLY, READ|= WRITE)) =3D=3D -1)
     {
 = ;         return(0);
&= nbsp;    }
     close(= fd);
     return(1);
}
 
Note that create() returns a 1 on success and a 0 on= failure.
 
Lucas

------=_NextPart_001_0000_01C32030.8F63FE80--