* 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

@@ -18,6 +18,7 @@ details. */
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "cygwin/version.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@@ -1084,15 +1085,13 @@ int fhandler_base::fcntl (int cmd, void *arg)
* ignored as well.
*/
const int allowed_flags = O_APPEND | O_NONBLOCK | OLD_O_NDELAY;
/* 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;
int flags = get_flags () & ~allowed_flags;
set_flags (flags | (new_flags & allowed_flags));
int new_flags = (int) arg & allowed_flags;
/* 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. */
if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
new_flags = O_NONBLOCK;
set_flags ((get_flags () & ~allowed_flags) | new_flags);
}
res = 0;
break;