It is better to use the S_IS* macros instead of only masking with the
S_IF* flags. For example, sb.st_mode & S_ISDIR is true also when the
file is actually a unix domain socket. 

        -Otto


Index: ca.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/apps/ca.c,v
retrieving revision 1.19
diff -u -p -r1.19 ca.c
--- ca.c        27 Jun 2006 05:06:54 -0000      1.19
+++ ca.c        25 Sep 2006 18:31:22 -0000
@@ -832,8 +832,8 @@ bad:
                        perror(outdir);
                        goto err;
                        }
-#ifdef S_IFDIR
-               if (!(sb.st_mode & S_IFDIR))
+#ifdef S_ISDIR
+               if (!S_ISDIR(sb.st_mode))
                        {
                        BIO_printf(bio_err,"%s need to be a 
directory\n",outdir);
                        perror(outdir);



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to