Replace homegrown tests for FIFO (... & S_IFIFO) by S_ISFIFO. The old code

was "correct" by luck - we don't have any other file type whose S_IF* bits
in sys/stat.h overlap with S_IFIFO.

Originally discovered by Paul Stoeber in OpenBSD.
This commit is contained in:
pavel 2006-09-25 16:16:18 +00:00
parent c43e654c14
commit 3cdb79bdae
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_file.c,v 1.29 2005/12/11 12:20:02 christos Exp $ */
/* $NetBSD: hpux_file.c,v 1.30 2006/09/25 16:16:18 pavel Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -119,7 +119,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_file.c,v 1.29 2005/12/11 12:20:02 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: hpux_file.c,v 1.30 2006/09/25 16:16:18 pavel Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -771,7 +771,7 @@ hpux_sys_mknod(l, v, retval)
/*
* BSD handles FIFOs separately.
*/
if (SCARG(uap, mode) & S_IFIFO) {
if (S_ISFIFO(SCARG(uap, mode))) {
SCARG(&bma, path) = SCARG(uap, path);
SCARG(&bma, mode) = SCARG(uap, mode);
return (sys_mkfifo(l, uap, retval));

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_file.c,v 1.73 2006/07/23 22:06:09 ad Exp $ */
/* $NetBSD: linux_file.c,v 1.74 2006/09/25 16:16:18 pavel Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.73 2006/07/23 22:06:09 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.74 2006/09/25 16:16:18 pavel Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -737,7 +737,7 @@ linux_sys_mknod(l, v, retval)
/*
* BSD handles FIFOs separately
*/
if (SCARG(uap, mode) & S_IFIFO) {
if (S_ISFIFO(SCARG(uap, mode))) {
struct sys_mkfifo_args bma;
SCARG(&bma, path) = SCARG(uap, path);