RT4033: Use OPENSSL_SYS_UNIX not "unix"
[openssl.git] / apps / rehash.c
index 8417449235484631dbd409d1044764d045c03e6f..c8bfb05b78200ea76629858002dce5149858da99 100644 (file)
@@ -59,7 +59,7 @@
 
 #include "apps.h"
 
-#if defined(unix) || defined(__APPLE__)
+#if defined(OPENSSL_SYS_UNIX) || defined(__APPLE__)
 # include <unistd.h>
 # include <stdio.h>
 # include <limits.h>
@@ -313,6 +313,10 @@ static int do_dir(const char *dirname, enum Hash h)
     const char *filename;
     char *buf;
 
+    if (app_access(dirname, W_OK) < 0) {
+        BIO_printf(bio_err, "Skipping %s, can't write\n", dirname);
+        return 1;
+    }
     buflen = strlen(dirname);
     pathsep = (buflen && dirname[buflen - 1] == '/') ? "" : "/";
     buflen += NAME_MAX + 2;
@@ -484,4 +488,4 @@ int rehash_main(int argc, char **argv)
     return (1);
 }
 
-#endif /* defined(unix) || defined(__APPLE__) */
+#endif /* defined(OPENSSL_SYS_UNIX) || defined(__APPLE__) */