Date: Fri, 24 May 1996 14:31:04 +0200 From: Zahemszky Gabor <zgabor@code.hu> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1242: S_ISFIFO === S_ISSOCK Message-ID: <199605241231.OAA00390@zg.CoDe.hu> Resent-Message-ID: <199605241230.FAA25944@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <zgabor@CoDe.hu> >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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605241231.OAA00390>