[3852] in Kerberos
Re: v5srvtab lossage ... anyone seen this?
daemon@ATHENA.MIT.EDU (John Gardiner Myers)
Fri Sep 16 16:04:47 1994
To: kerberos@MIT.EDU
Date: Fri, 16 Sep 1994 11:59:53 -0400
From: John Gardiner Myers <jgm+@CMU.EDU>
hobbit@elf.com (*Hobbit*) writes:
> fopen (said file, "rb+) /* succeeds */
Dollars to donuts that's the culprit.
To get a fcntl exclusive lock, you have to have the file descriptor
open for writing. fnctl locking blows chunks.
"rb+" is the correct way in ANSI C to open a file both for reading and
writing in binary mode, without blowing away the existing contents of
the file.
Many Unix versions of fopen stop parsing on the "b" because they don't
know about it, binary mode being meaningless on unix. If fopen stops
parsing on the 'b' and misses the '+', the file won't be opened for
writing and the fcntl lock attempt will fail.
--
_.John G. Myers Internet: jgm+@CMU.EDU
LoseNet: ...!seismo!ihnp4!wiscvm.wisc.edu!give!up