rad_unlockfd
Alan DeKok
aland at deployingradius.com
Wed May 15 19:51:49 CEST 2013
Brian Candler wrote:
> I noticed something odd in rad_unlockfd - both 2.x.x and master.
..
> That is: to unlock, the command should be F_SETLK(W) and the l_type should
> be F_UNLCK. The OSX (BSD) manpage agrees.
>
> On Linux, the constant F_UNLCK is 2, so calling fcntl(fd, F_UNLCK...)
> is the same as calling fcntl(fd, F_SETFD...)
OK.
> The other oddity is using SEEK_CUR for both lock and unlock. If you have
> written to the file in the mean time, then the current file offset will have
> changed, so you may end up unlocking a different byte range to the one you
> locked. I'd say SEEK_SET with offset 0 and length 0 (which locks or unlocks
> the entire file, including past its end) is safest - at least when
> unlocking.
That sounds right, IIRC.
> As far as I can see, only rad_utmp calls this function, so the impact is not
> huge.
OK.
Alan DeKok.
More information about the Freeradius-Devel
mailing list