mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-09 02:29:07 +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 (); }
|
int saw_shutdown () const { return shmem->shutdown (); }
|
||||||
bool saw_shutdown_read () const { return !!(saw_shutdown () & _SHUT_RECV); }
|
bool saw_shutdown_read () const { return !!(saw_shutdown () & _SHUT_RECV); }
|
||||||
|
|
||||||
|
int open (int flags, mode_t mode = 0);
|
||||||
int close ();
|
int close ();
|
||||||
int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid);
|
int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid);
|
||||||
void *serialize (int fd);
|
void *serialize (int fd);
|
||||||
|
@ -1298,6 +1298,11 @@ fhandler_socket_unix::~fhandler_socket_unix ()
|
|||||||
int
|
int
|
||||||
fhandler_socket_unix::dup (fhandler_base *child, int flags, DWORD src_pid)
|
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;
|
int ret = -1;
|
||||||
HANDLE src_proc = GetCurrentProcess ();
|
HANDLE src_proc = GetCurrentProcess ();
|
||||||
fhandler_socket_unix *fhs = (fhandler_socket_unix *) child;
|
fhandler_socket_unix *fhs = (fhandler_socket_unix *) child;
|
||||||
@ -1906,9 +1911,23 @@ fhandler_socket_unix::shutdown (int how)
|
|||||||
return 0;
|
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
|
int
|
||||||
fhandler_socket_unix::close ()
|
fhandler_socket_unix::close ()
|
||||||
{
|
{
|
||||||
|
if (get_flags () & O_PATH)
|
||||||
|
return fhandler_base::close ();
|
||||||
|
|
||||||
HANDLE evt = InterlockedExchangePointer (&cwt_termination_evt, NULL);
|
HANDLE evt = InterlockedExchangePointer (&cwt_termination_evt, NULL);
|
||||||
HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL);
|
HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL);
|
||||||
if (thr)
|
if (thr)
|
||||||
@ -3537,6 +3556,11 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p)
|
|||||||
int
|
int
|
||||||
fhandler_socket_unix::fcntl (int cmd, intptr_t arg)
|
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;
|
int ret = -1;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user