dso_vms needs to add the .EXE extension if there is none already
authorRichard Levitte <levitte@openssl.org>
Fri, 30 Jan 2015 03:44:17 +0000 (04:44 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 30 Jan 2015 04:02:56 +0000 (05:02 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit be7b1097e28ff6d49f0d4b7ab8b036d6da87ebc6)

crypto/dso/dso_vms.c

index 14d885df15cd91e5ab76693eb6677eacbf3595ee..8793f7e0ff4154b22edda209a9967adbe7db206d 100644 (file)
@@ -172,6 +172,7 @@ static int vms_load(DSO *dso)
 # endif                         /* __INITIAL_POINTER_SIZE == 64 */
 
     const char *sp1, *sp2;      /* Search result */
 # endif                         /* __INITIAL_POINTER_SIZE == 64 */
 
     const char *sp1, *sp2;      /* Search result */
+    const char *ext = NULL;    /* possible extension to add */
 
     if (filename == NULL) {
         DSOerr(DSO_F_VMS_LOAD, DSO_R_NO_FILENAME);
 
     if (filename == NULL) {
         DSOerr(DSO_F_VMS_LOAD, DSO_R_NO_FILENAME);
@@ -213,12 +214,20 @@ static int vms_load(DSO *dso)
         sp1++;                  /* The byte after the found character */
     /* Now, let's see if there's a type, and save the position in sp2 */
     sp2 = strchr(sp1, '.');
         sp1++;                  /* The byte after the found character */
     /* Now, let's see if there's a type, and save the position in sp2 */
     sp2 = strchr(sp1, '.');
+    /*
+     * If there is a period and the next character is a semi-colon,
+     * we need to add an extension
+     */
+    if (sp2 != NULL && sp2[1] == ';')
+        ext = ".EXE";
     /*
      * If we found it, that's where we'll cut.  Otherwise, look for a version
      * number and save the position in sp2
      */
     /*
      * If we found it, that's where we'll cut.  Otherwise, look for a version
      * number and save the position in sp2
      */
-    if (sp2 == NULL)
+    if (sp2 == NULL) {
         sp2 = strchr(sp1, ';');
         sp2 = strchr(sp1, ';');
+        ext = ".EXE";
+    }
     /*
      * If there was still nothing to find, set sp2 to point at the end of the
      * string
     /*
      * If there was still nothing to find, set sp2 to point at the end of the
      * string
@@ -244,6 +253,11 @@ static int vms_load(DSO *dso)
 
     strncpy(p->imagename, filename, sp1 - filename);
     p->imagename[sp1 - filename] = '\0';
 
     strncpy(p->imagename, filename, sp1 - filename);
     p->imagename[sp1 - filename] = '\0';
+    if (ext) {
+        strcat(p->imagename, ext);
+        if (*sp2 == '.')
+            sp2++;
+    }
     strcat(p->imagename, sp2);
 
     p->filename_dsc.dsc$w_length = strlen(p->filename);
     strcat(p->imagename, sp2);
 
     p->filename_dsc.dsc$w_length = strlen(p->filename);