diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 80a78d14c..c54780ef6 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -834,6 +834,8 @@ class fhandler_socket_local: public fhandler_socket_wsock int getsockopt (int level, int optname, const void *optval, __socklen_t *optlen); + int open (int flags, mode_t mode = 0); + int close (); int __reg2 fstat (struct stat *buf); int __reg2 fstatvfs (struct statvfs *buf); int __reg1 fchmod (mode_t newmode); diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index f88ced22d..e7f4fe603 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -634,6 +634,26 @@ fhandler_socket_local::dup (fhandler_base *child, int flags) return fhandler_socket_wsock::dup (child, flags); } +int +fhandler_socket_local::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_local::close () +{ + if (get_flags () & O_PATH) + return fhandler_base::close (); + else + return fhandler_socket_wsock::close (); +} + int __reg2 fhandler_socket_local::fstat (struct stat *buf) {