mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-08 18:19:08 +08:00
Cygwin: AF_UNIX: allow opening with the O_PATH flag
This was done for the fhandler_socket_local class in commits 3a2191653a, 141437d374, and 477121317d, but the fhandler_socket_unix class was overlooked.
This commit is contained in:
parent
7c5a0c04ae
commit
8145385408
@ -1249,6 +1249,7 @@ class fhandler_socket_unix : public fhandler_socket
|
||||
int saw_shutdown () const { return shmem->shutdown (); }
|
||||
bool saw_shutdown_read () const { return !!(saw_shutdown () & _SHUT_RECV); }
|
||||
|
||||
int open (int flags, mode_t mode = 0);
|
||||
int close ();
|
||||
int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid);
|
||||
void *serialize (int fd);
|
||||
|
@ -1298,6 +1298,11 @@ fhandler_socket_unix::~fhandler_socket_unix ()
|
||||
int
|
||||
fhandler_socket_unix::dup (fhandler_base *child, int flags, DWORD src_pid)
|
||||
{
|
||||
if (get_flags () & O_PATH)
|
||||
/* We're viewing the socket as a disk file, but fhandler_base::dup
|
||||
suffices here. */
|
||||
return fhandler_base::dup (child, flags, src_pid);
|
||||
|
||||
int ret = -1;
|
||||
HANDLE src_proc = GetCurrentProcess ();
|
||||
fhandler_socket_unix *fhs = (fhandler_socket_unix *) child;
|
||||
@ -1906,9 +1911,23 @@ fhandler_socket_unix::shutdown (int how)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
fhandler_socket_unix::open (int flags, mode_t mode)
|
||||
{
|
||||
/* We don't support opening sockets unless O_PATH is specified. */
|
||||
if (flags & O_PATH)
|
||||
return open_fs (flags, mode);
|
||||
|
||||
set_errno (EOPNOTSUPP);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
fhandler_socket_unix::close ()
|
||||
{
|
||||
if (get_flags () & O_PATH)
|
||||
return fhandler_base::close ();
|
||||
|
||||
HANDLE evt = InterlockedExchangePointer (&cwt_termination_evt, NULL);
|
||||
HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL);
|
||||
if (thr)
|
||||
@ -3537,6 +3556,11 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p)
|
||||
int
|
||||
fhandler_socket_unix::fcntl (int cmd, intptr_t arg)
|
||||
{
|
||||
if (get_flags () & O_PATH)
|
||||
/* We're viewing the socket as a disk file, but
|
||||
fhandler_base::fcntl suffices here. */
|
||||
return fhandler_base::fcntl (cmd, arg);
|
||||
|
||||
int ret = -1;
|
||||
|
||||
switch (cmd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user