From owner-freebsd-bugs Fri May 24 05:30:07 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id FAA25961 for bugs-outgoing; Fri, 24 May 1996 05:30:07 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id FAA25944; Fri, 24 May 1996 05:30:05 -0700 (PDT) Resent-Date: Fri, 24 May 1996 05:30:05 -0700 (PDT) Resent-Message-Id: <199605241230.FAA25944@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, zgabor@code.hu Received: from mail.EUnet.hu (mail.eunet.hu [193.225.28.100]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id FAA25222 for ; Fri, 24 May 1996 05:23:20 -0700 (PDT) Received: by mail.EUnet.hu, id OAA16081; Fri, 24 May 1996 14:23:12 +0200 Received: from zg.CoDe.hu by CoDe.CoDe.hu (OAA02937); Fri, 24 May 1996 14:19:57 GMT Received: (from zgabor@localhost) by zg.CoDe.hu (8.6.12/8.6.12) id OAA00390; Fri, 24 May 1996 14:31:04 +0200 Message-Id: <199605241231.OAA00390@zg.CoDe.hu> Date: Fri, 24 May 1996 14:31:04 +0200 From: Zahemszky Gabor Reply-To: zgabor@code.hu To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/1242: S_ISFIFO === S_ISSOCK Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1242 >Category: bin >Synopsis: In the "sys/stat.h" file, the S_ISFIFO and S_ISSOCK macros are the same >Confidential: yes >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri May 24 05:30:04 PDT 1996 >Last-Modified: >Originator: Zahemszky Gabor >Organization: >Release: FreeBSD 2.1.0-RELEASE i386 >Environment: FreeBSD 2.1.0-RELEASE from Walnut Creek CD >Description: In the /usr/include/sys/stat.h, there are two macros: S_ISFIFO and S_ISSOCK. They are the same (as mentioned in the comment). But it's not very usable, eg. the tar (GNU) and cpio (GNU) from the distribution, save sockets as pipes. And I cannot write a program like this: if (S_ISFIFO( f ) ) { /* it's a fifo */ ... } else { if ( S_ISSOCK( f ) ) { /* it's a socket */ ... } .... } because I got fifo every time (or got socket, if I changes the two ``if''-s). >How-To-Repeat: Look into the include file, or save /dev/log with tar/cpio, and restore it, or look into the toc. >Fix: You have to make difference between them, as in many other Unices. Eg: #define S_ISFIFO( m ) (((m) & 0170000 ) == 0010000 ) #define S_ISSOCK( m ) (((m) & 0170000 ) == 0140000 ) >Audit-Trail: >Unformatted: