Date: Wed, 22 May 1996 11:33:15 +0000 (GMT) From: Gabor Zahemszky <zgabor@CoDe.hu> To: freebsd-questions@freebsd.org Subject: S_ISFIFO === S_ISSOCK Message-ID: <199605221133.LAA01574@CoDe.CoDe.hu>
next in thread | raw e-mail | index | archive | help
Hi! I've found, that in 2.1.0R (from WC CD), in /usr/include/sys/stat.h, the macros S_ISFIFO and S_ISSOCK are generate the same (as it says in the comment). It's not so good, eg. the tar and cpio (from the distribution, they are the GNU version), both cannot save a socket. Perfectly, they can save, but save as a pipe. I tried it in some Unices, and all of them (if they have this type of file), make a difference between them. So, what's the reason, that macro defined such a non-standard (means, unusable) way. (I have to dig into the source of tar/cpio, to find it out, why are they say a saved socket, that's a pipe. - Yes, I know, that saving a pipe, or saving a socket is not a very good practice, but saving them is only one of the problems.) Eg, if I would like to write a `ls', that code doesn't work: if ( S_ISFIFO( f ) ) { printf( "fifo" ); } else if (S_ISSOCK( f ) ) { printf( "socket" ); } ... Of course, it always says, that's a pipe, and never says, socket. -- Gabor Zahemszky <zgabor@CoDe.hu> -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:- Earth is the cradle of human sense, but you can't stay in the cradle forever. Tsiolkovsky
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605221133.LAA01574>