* cygheap.cc (cygheap_root::set): Avoid treating '/' specially.

* fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style flag
passed in from application.
* fhandler_socket.cc (fhandler_socket::fcntl): Ditto.
* fhandler.h: Set constant for future use.
* winsup.h: Define OLD_O_NDELAY only for old programs.
* include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
This commit is contained in:
Christopher Faylor
2001-08-07 00:01:42 +00:00
parent 386abb05d9
commit 96a3f4ae68
9 changed files with 57 additions and 30 deletions

View File

@@ -24,6 +24,8 @@
#include <winsock2.h>
#include "cygerrno.h"
#include "security.h"
#include "cygwin/version.h"
#include "perprocess.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@@ -412,17 +414,18 @@ fhandler_socket::fcntl (int cmd, void *arg)
{
/* Care for the old O_NDELAY flag. If one of the flags is set,
both flags are set. */
int new_flags = (int) arg;
if (new_flags & (O_NONBLOCK | OLD_O_NDELAY))
new_flags |= O_NONBLOCK | OLD_O_NDELAY;
request = (new_flags & O_NONBLOCK) ? 1 : 0;
current = (get_flags () & O_NONBLOCK) ? 1 : 0;
if (request != current && (res = ioctl (FIONBIO, &request)))
const int allowed_flags = O_NONBLOCK | OLD_O_NDELAY;
/* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
Set only the flag that has been passed in. If both are set, just
record O_NONBLOCK. */
int new_flags = (int) arg & allowed_flags;
if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
new_flags = O_NONBLOCK;
current = get_flags () & allowed_flags;
if (!!current != !!new_flags && (res = ioctl (FIONBIO, &request)))
break;
if (request)
set_flags (get_flags () | O_NONBLOCK | OLD_O_NDELAY);
else
set_flags (get_flags () & ~(O_NONBLOCK | OLD_O_NDELAY));
set_flags ((get_flags () & ~allowed_flags) | new_flags);
break;
}
default: