From: Martin Stromberg Message-Id: <200012120811.JAA14917@lws256.lu.erisoft.se> Subject: Re: Locking fcntl changes #2 To: djgpp-workers AT delorie DOT com Date: Tue, 12 Dec 2000 09:11:52 +0100 (MET) In-Reply-To: <5.0.2.1.0.20001212000231.02394850@pop5.banet.net> from "Peter J. Farley III" at Dec 12, 2000 12:11:23 AM 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 > diff -ruN djgpp-cvs/src/libc/posix/fcntl/fcntl.c djgpp/src/libc/posix/fcntl/fcntl.c > --- djgpp-cvs/src/libc/posix/fcntl/fcntl.c Thu Jun 3 13:27:38 1999 > +++ djgpp/src/libc/posix/fcntl/fcntl.c Mon Dec 11 20:41:46 2000 . . . > int > fcntl(int fd, int cmd, ...) > { . . . > + case F_GETLK: > + case F_SETLK: > + case F_SETLKW: > + { > + struct flock *lock_req = NULL; /* shut up -Wall */ > + int ret = -1; > + off_t pos, cur_pos, lock_pos; > + off_t len; > + > + /* First check if SHARE is loaded */ > + ret = _get_SHARE_status(); > + > + if (!ret) /* Then SHARE is NOT loaded, just return success */ > + { > + if (cmd == F_GETLK) /* Then make believe the lock is available */ > + lock_req->l_type = F_UNLCK; > + > + return ret; > + } > + else ret = -1; /* Restore default value */ > + > + cur_pos = lseek(fd, 0, SEEK_CUR); > + if (cur_pos < 0) > + return -1; /* Assumes lseek has set errno */ Why are you using lseek() here and not llseek? . . . > + case F_GETLK64: > + case F_SETLK64: > + case F_SETLKW64: > + { > + struct flock64 *lock_req = NULL; /* shut up -Wall */ > + int ret = -1; > + long long int ret64 = -1L; > + offset_t pos, cur_pos, lock_pos; > + offset_t len; > + > + /* First check if SHARE is loaded */ > + ret = _get_SHARE_status(); > + > + if (!ret) /* Then SHARE is NOT loaded, just return success */ > + { > + if (cmd == F_GETLK64) /* Then make believe the lock is available */ > + lock_req->l_type = F_UNLCK; > + > + return ret; > + } > + else ret = -1; /* Restore default value */ > + > + cur_pos = llseek(fd, 0L, SEEK_CUR); > + if (cur_pos < 0) > + return -1; /* Assumes lseek has set errno */ ^^^^^ Don't you mean llseek()? (Several occurences.) Right, MartinS