]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Protect both the socket and fifo tests with #ifdef's.
authorMark Andrews <marka@isc.org>
Thu, 20 Jun 2002 01:19:51 +0000 (01:19 +0000)
committerMark Andrews <marka@isc.org>
Thu, 20 Jun 2002 01:19:51 +0000 (01:19 +0000)
lib/isc/unix/entropy.c

index eedd1fd438db3cff6a2ee8e3eff84e7b4896ec4c..21a797a3c532c9a2ae6a4f365cfb612b518fe40d 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: entropy.c,v 1.67 2002/06/05 02:20:59 marka Exp $ */
+/* $Id: entropy.c,v 1.68 2002/06/20 01:19:51 marka Exp $ */
 
 /*
  * This is the system depenedent part of the ISC entropy API.
@@ -467,7 +467,7 @@ isc_result_t
 isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
        int fd;
        struct stat _stat;
-       isc_boolean_t is_usocket;
+       isc_boolean_t is_usocket = ISC_FALSE;
        isc_boolean_t is_connected = ISC_FALSE;
        isc_result_t ret;
        isc_entropysource_t *source;
@@ -490,17 +490,18 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
         * the program to look at an actual FIFO as its source of
         * entropy.
         */
-       if ((_stat.st_mode & S_IFMT) == S_IFSOCK
-#ifdef _SOCKET_IS_FIFO
-            || (_stat.st_mode & S_IFMT) == S_IFIFO
+#if defined(S_ISSOCK)
+       if (S_ISSOCK(_stat.st_mode))
+               is_usocket = ISC_TRUE;
 #endif
-           ) {
-               fd = socket(PF_UNIX, SOCK_STREAM, 0);
+#if defined(S_ISFIFO)
+       if (S_ISFIFO(_stat.st_mode))
                is_usocket = ISC_TRUE;
-       } else {
+#endif
+       if (is_usocket)
+               fd = socket(PF_UNIX, SOCK_STREAM, 0);
+       else
                fd = open(fname, O_RDONLY | O_NONBLOCK, 0);
-               is_usocket = ISC_FALSE;
-       }
 
        if (fd < 0) {
                ret = isc__errno2result(errno);