[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-bugs
Subject:    documentation/4309: pw_lock(3) does not flock(2), documentation update
From:       peter_philipp () freenet ! de
Date:       2005-07-28 19:15:45
Message-ID: 20050728191545.5BF24B01A1 () neptune ! solarsail ! org
[Download RAW message or body]

> Number:         4309
> Category:       documentation
> Synopsis:       documentation doesn't reflect reality
> Confidential:   yes
> Severity:       non-critical
> Priority:       low
> Responsible:    bugs
> State:          open
> Quarter:        
> Keywords:       
> Date-Required:
> Class:          doc-bug
> Submitter-Id:   net
> Arrival-Date:   Thu Jul 28 19:30:02 GMT 2005
> Closed-Date:
> Last-Modified:
> Originator:     Peter Philipp
> Release:        1.11
> Organization:
net
> Environment:
	
	System      : OpenBSD 3.7
	Architecture: OpenBSD.amd64
	Machine     : amd64
> Description:
	in pw_lock(3) pw_lock is described as creating an exclusive lock using
flock(2) semantics.  my /usr/src/lib/libutil/passwd.c function pw_lock() doesn't \
reflect that at all, all that's done is a open(.., O_WRONLY | O_CREAT | O_EXCL, ..) \
and upon that a fcntl(fd, f_SETFD, 1) on the descriptor which is closing  the fd on \
exec flag, atomicity in the lock mechanism relies on opening and  creating the file, \
which in fact makes this a lockfile, where no flock()  locking is performed.
> How-To-Repeat:
	read the code, read the manpage
> Fix:
Index: pw_lock.3
===================================================================
RCS file: /cvs/src/lib/libutil/pw_lock.3,v
retrieving revision 1.11
diff -u -r1.11 pw_lock.3
--- pw_lock.3	7 Mar 2005 23:01:40 -0000	1.11
+++ pw_lock.3	28 Jul 2005 19:03:23 -0000
@@ -59,9 +59,7 @@
 .Fn pw_lock
 function attempts to lock the passwd database by creating the file
 .Pa /etc/ptmp
-with an exclusive lock (using
-.Xr flock 2
-semantics) and returns the file descriptor of that file.
+as a lockfile and returns the file descriptor of that file.
 If
 .Fa retries
 is greater than zero,


> Release-Note:
> Audit-Trail:
> Unformatted:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic