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
[EMAIL PROTECTED]                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Attachment: pgpjx5eXyx1Yi.pgp
Description: PGP signature

Reply via email to