Cygwin: AF_UNIX: allow opening with the O_PATH flag
This was done for the fhandler_socket_local class in commits3a2191653a,141437d374, and477121317d, but the fhandler_socket_unix class was overlooked.
This commit is contained in:
		
							parent
							
								
									2911d50e70
								
							
						
					
					
						commit
						949fe7bec5
					
				|  | @ -1111,6 +1111,7 @@ class fhandler_socket_unix : public fhandler_socket | |||
|   int getsockname (struct sockaddr *name, int *namelen); | ||||
|   int getpeername (struct sockaddr *name, int *namelen); | ||||
|   int shutdown (int how); | ||||
|   int open (int flags, mode_t mode = 0); | ||||
|   int close (); | ||||
|   int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); | ||||
|   ssize_t recvmsg (struct msghdr *msg, int flags); | ||||
|  |  | |||
|  | @ -1208,6 +1208,11 @@ fhandler_socket_unix::~fhandler_socket_unix () | |||
| int | ||||
| fhandler_socket_unix::dup (fhandler_base *child, int flags) | ||||
| { | ||||
|   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); | ||||
| 
 | ||||
|   if (fhandler_socket::dup (child, flags)) | ||||
|     { | ||||
|       __seterrno (); | ||||
|  | @ -1801,9 +1806,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) | ||||
|  | @ -2281,6 +2300,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…
	
		Reference in New Issue