summaryrefslogtreecommitdiff
path: root/pflocal
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-08-09 21:13:53 +0000
committerMark Kettenis <kettenis@gnu.org>2000-08-09 21:13:53 +0000
commitb4cc956f8c24c462db7235cde475ca9623e760f2 (patch)
treeba4e9a986daf69a8a47ae68891cb6f6e1e944594 /pflocal
parenta6888a2b3a918920fe27133308c820e78dcecf16 (diff)
* pf.c (S_socket_create): Only accept S_IFCHR, S_IFSOCK and
S_IFIFO as `magic' protocols.
Diffstat (limited to 'pflocal')
-rw-r--r--pflocal/ChangeLog5
-rw-r--r--pflocal/pf.c19
2 files changed, 18 insertions, 6 deletions
diff --git a/pflocal/ChangeLog b/pflocal/ChangeLog
index a8b48a63..eb0f1fb1 100644
--- a/pflocal/ChangeLog
+++ b/pflocal/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-09 Mark Kettenis <kettenis@gnu.org>
+
+ * pf.c (S_socket_create): Only accept S_IFCHR, S_IFSOCK and
+ S_IFIFO as `magic' protocols.
+
2000-08-02 Mark Kettenis <kettenis@gnu.org>
Add `magic' protocols to specify the file type of a sockets. This
diff --git a/pflocal/pf.c b/pflocal/pf.c
index 1244c600..d72e01b5 100644
--- a/pflocal/pf.c
+++ b/pflocal/pf.c
@@ -42,12 +42,19 @@ S_socket_create (mach_port_t pf,
the file type of the socket. The primary application is to make
sockets that pretend to be a FIFO, for the implementations of
pipes. */
- if (protocol == 0)
- mode = S_IFSOCK;
- else if ((protocol & ~S_IFMT) == 0)
- mode = protocol & S_IFMT;
- else
- return EPROTONOSUPPORT;
+ switch (protocol)
+ {
+ case 0:
+ mode = S_IFSOCK;
+ break;
+ case S_IFCHR:
+ case S_IFSOCK:
+ case S_IFIFO:
+ mode = protocol;
+ break;
+ default:
+ return EPROTONOSUPPORT;
+ }
switch (sock_type)
{