If errno is ENXIO in BSS_new_file(), set BIO_R_NO_SUCH_FILE
authorRichard Levitte <levitte@openssl.org>
Thu, 8 Sep 2016 21:39:26 +0000 (23:39 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 8 Sep 2016 22:11:55 +0000 (00:11 +0200)
VMS sets that errno when the device part of a file spec is malformed
or a logical name that doesn't exist.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit e82e2186e93e9a678dd8c0c5ba084d21d27d4d62)

crypto/bio/bss_file.c

index bfba93e62bbd0869195f5362b80c35d5ea0979e9..a6e3b3ac0130aa5fface417cab731a30e308ba2a 100644 (file)
@@ -174,7 +174,11 @@ BIO *BIO_new_file(const char *filename, const char *mode)
     if (file == NULL) {
         SYSerr(SYS_F_FOPEN, get_last_sys_error());
         ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
-        if (errno == ENOENT)
+        if (errno == ENOENT
+# ifdef ENXIO
+            || errno == ENXIO
+# endif
+            )
             BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
         else
             BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB);