From 110f72c4144fd9722ae29e8bf0b8cd40d5939ff9 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Thu, 14 Nov 2002 20:39:56 +0000 Subject: [PATCH] Return EINVAL when the user tries to create a FIFO under afs, instead of silently creating a regular file. (cherry picked from commit 74ad450bc202101b99923e18828073ee7208320c) --- src/afs/LINUX/osi_vfs.hin | 1 + src/afs/VNOPS/afs_vnop_create.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/afs/LINUX/osi_vfs.hin b/src/afs/LINUX/osi_vfs.hin index ee0588b91..90a572c17 100644 --- a/src/afs/LINUX/osi_vfs.hin +++ b/src/afs/LINUX/osi_vfs.hin @@ -44,6 +44,7 @@ typedef struct vnode vnode_t; #define VCHR S_IFCHR #define VLNK S_IFLNK #define VSOCK S_IFSOCK +#define VFIFO S_IFIFO /* vcexcl - used only by afs_create */ enum vcexcl { EXCL, NONEXCL } ; diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index 3a61d8ea8..dc97a69cd 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -106,14 +106,18 @@ afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred) code = EINVAL; goto done; } -#if defined(AFS_SUN5_ENV) - if ((attrs->va_type == VBLK) || (attrs->va_type == VCHR)) { -#else - if ((attrs->va_type == VBLK) || (attrs->va_type == VCHR) || (attrs->va_type == VSOCK)) { + switch (attrs->va_type) { + case VBLK: + case VCHR: +#if !defined(AFS_SUN5_ENV) + case VSOCK: #endif - /* We don't support special devices */ + case VFIFO: + /* We don't support special devices or FIFOs */ code = EINVAL; goto done; + default: + ; } code = afs_EvalFakeStat(&adp, &fakestate, &treq); if (code) goto done; -- 2.39.5