From b4cc956f8c24c462db7235cde475ca9623e760f2 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 9 Aug 2000 21:13:53 +0000 Subject: * pf.c (S_socket_create): Only accept S_IFCHR, S_IFSOCK and S_IFIFO as `magic' protocols. --- pflocal/pf.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'pflocal/pf.c') 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) { -- cgit v1.2.3