Keep disclaiming 16-bit platform support. For now remove WIN16 references
[oweals/openssl.git] / crypto / x509 / by_dir.c
index d56679177bf4451c86b87f5164b252967e81035c..6398d35a0a938984fda4abf772eb49b0203aed59 100644 (file)
@@ -65,9 +65,7 @@
 #ifndef NO_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#ifdef MAC_OS_pre_X
-# include <stat.h>
-#else
+#ifndef OPENSSL_NO_POSIX_IO
 # include <sys/stat.h>
 #endif
 
@@ -114,7 +112,7 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
        {
        int ret=0;
        BY_DIR *ld;
-       char *dir;
+       char *dir = NULL;
 
        ld=(BY_DIR *)ctx->method_data;
 
@@ -122,19 +120,18 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
                {
        case X509_L_ADD_DIR:
                if (argl == X509_FILETYPE_DEFAULT)
-                       dir=(char *)Getenv(X509_get_default_cert_dir_env());
+                       {
+                       dir=(char *)getenv(X509_get_default_cert_dir_env());
                        if (dir)
-                       ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM);
+                               ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM);
                        else
-                       {
-                       ret=add_cert_dir(ld,X509_get_default_cert_dir(),
-                               X509_FILETYPE_PEM);
-                       }
+                               ret=add_cert_dir(ld,X509_get_default_cert_dir(),
+                                       X509_FILETYPE_PEM);
                        if (!ret)
                                {
                                X509err(X509_F_DIR_CTRL,X509_R_LOADING_CERT_DIR);
                                }
-
+                       }
                else
                        ret=add_cert_dir(ld,argp,(int)argl);
                break;
@@ -255,7 +252,6 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
        int i,j,k;
        unsigned long h;
        BUF_MEM *b=NULL;
-       struct stat st;
        X509_OBJECT stmp,*tmp;
        const char *postfix="";
 
@@ -335,8 +331,13 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
                                        postfix,k);
                                }
                        k++;
+#ifndef OPENSSL_NO_POSIX_IO
+                       {
+                       struct stat st;
                        if (stat(b->data,&st) < 0)
                                break;
+                       }
+#endif
                        /* found one. */
                        if (type == X509_LU_X509)
                                {