cvs commit: src/lib/libutil flopen.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed May 23 10:02:20 UTC 2007


On Wed, May 23, 2007 at 08:12:34AM +0000, Dag-Erling Smorgrav wrote:
> des         2007-05-23 08:12:34 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     lib/libutil          flopen.c 
>   Log:
>   If (flags & O_TRUNC), don't truncate the file until we've successfully
>   locked it.
>   
>   MFC after:      3 weeks
>   
>   Revision  Changes    Path
>   1.5       +11 -1     src/lib/libutil/flopen.c
> 
> http://cvsweb.FreeBSD.org/src/lib/libutil/flopen.c.diff?r1=1.4&r2=1.5&f=h
> --- src/lib/libutil/flopen.c	2007/05/10 15:01:42	1.4
> +++ src/lib/libutil/flopen.c	2007/05/23 08:12:34	1.5
> @@ -26,7 +26,7 @@
>   */
>  
>  #include <sys/cdefs.h>
> -__FBSDID("$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/lib/libutil/flopen.c,v 1.4 2007/05/10 15:01:42 des Exp $");
> +__FBSDID("$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/lib/libutil/flopen.c,v 1.5 2007/05/23 08:12:34 des Exp $");
>  
>  #include <sys/file.h>
>  #include <sys/stat.h>
> @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: /usr/local/www/cvsro
>  int
>  flopen(const char *path, int flags, ...)
>  {
> -	int fd, operation, serrno;
> +	int fd, operation, serrno, truncate;
>  	struct stat sb, fsb;
>  	mode_t mode;
>  
> @@ -62,6 +62,9 @@ flopen(const char *path, int flags, ...)
>  	if (flags & O_NONBLOCK)
>  		operation |= LOCK_NB;
>  
> +	truncate = (flags & O_TRUNC);
> +	flags |= ~O_TRUNC;

flags &= ~O_TRUNC ?

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20070523/bce34079/attachment-0001.pgp


More information about the cvs-src mailing list