From: Martin Stromberg Message-Id: <200011271215.NAA06726@lws256.lu.erisoft.se> Subject: Re: Locking fcntl() and flock() patches To: djgpp-workers AT delorie DOT com Date: Mon, 27 Nov 2000 13:15:38 +0100 (MET) In-Reply-To: from "Eli Zaretskii" at Nov 27, 2000 01:44:20 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Eli said: > On Mon, 27 Nov 2000, Peter J. Farley III wrote: > > + case F_SETLKW: > > + { > > + struct flock *lock_req = NULL; /* shut up -Wall */ > > + int ret = -1; > > + off_t pos, cur_pos, lock_pos; > > + off_t len; > > + > > + > > + cur_pos = lseek(fd, 0, SEEK_CUR); > > This should check if cur_pos is -1, and if so, bail out. This might > happen, e.g., if fd is invalid. Not to mention the case of FAT32 and overflowing the off_t type. I suggest you use offset_t and llseek(). Is there somewhere we can put such DJGPP developing niceties (Do not use lseek() and off_t in libc. Use llseek() and offset_t instead.)? Right, MartinS