Re: fcntl bug

2009-08-30 Thread Christopher Faylor
On Sun, Aug 30, 2009 at 06:32:59PM -0600, Eric Blake wrote: >According to Eric Blake on 8/24/2009 9:15 AM: >>While we're at it, fcntl and dup2 both have another minor bug. POSIX >>states that fcntl(0,F_DUPFD,1000) should fail with EINVAL (not >>EBADF) and the similar dup2(0,1000) should fa

Re: fcntl bug

2009-08-30 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 8/24/2009 9:15 AM: > While we're at it, fcntl and dup2 both have another minor bug. POSIX states > that fcntl(0,F_DUPFD,1000) should fail with EINVAL (not EBADF) and the > similar dup2(0,1000) should fail with EBAD

Re: fcntl bug

2009-08-24 Thread Eric Blake
Christopher Faylor cygwin.com> writes: > >But POSIX does (and Linux at least obeys this part of POSIX, whether or > >not its man page says so): > > I checked in a fix for this a while ago. It's in the latest snapshot. While we're at it, fcntl and dup2 both have another minor bug. POSIX states

Re: fcntl bug

2009-08-21 Thread Christopher Faylor
On Fri, Aug 21, 2009 at 04:04:12PM -0600, Eric Blake wrote: >According to cygwin at sipxx.com on 8/21/2009 3:56 PM: >>It does reject the argument if the upper bound is reached. On the >>lower end, the linux man page does not specify that negative numbers >>are not allowed as arguments. > >But POSI

Re: fcntl bug

2009-08-21 Thread cygwin at sipxx.com
I see, I would concur based on the definition of the error code you quoted. I consulted only my memory just now, since I ran the same general test last week. Eric Blake wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to cygwin at sipxx.com on 8/21/2009 3:56 PM: It does reje

Re: fcntl bug

2009-08-21 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to cygwin at sipxx.com on 8/21/2009 3:56 PM: > It does reject the argument if the upper bound is reached. On the lower > end, the linux man page does not specify that negative numbers are not > allowed as arguments. But POSIX does (and Linux

Re: fcntl bug

2009-08-21 Thread cygwin at sipxx.com
It does reject the argument if the upper bound is reached. On the lower end, the linux man page does not specify that negative numbers are not allowed as arguments. Note, that fcntl is not supposed to be the same as dup2(), i.e., it does NOT duplicate the given fd into the new one specified, bu

fcntl bug

2009-08-21 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 fcntl is supposed to reject attempts to duplicate to an out-of-range fd. On Linux, this correctly fails with EINVAL. #include #include #include #include int main() { int i = fcntl (0, F_DUPFD, -1); printf ("%d %d %s\n", i, errno, strerror (err

Re: fcntl() bug? if called second times!

2003-01-13 Thread Pavel Tsekov
Hello, Cygwin doesn't support advisory file locking. It implements file locking via the Win32 api LockFile*. Find out more here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/lockfile.asp And more specifically this part: [...] Locking a portion of a file for shared

fcntl() bug? if called second times!

2003-01-13 Thread Heiko Elger
Hello, I try to comiple an run the distcc package - but I get errors while running. I figured out, tha the problems are the fcntl() calls - perhaps ther is a bug in cygwin? The following code runs differently in cygwin and linux. If I want ro lock the whole file twice, but still the same process,