Fix the BFD library to handle Windows pathnames with more than 260 characters and...
authorJaydeep Chauhan <jaydeepchauhan1494@gmail.com>
Mon, 18 May 2020 10:36:26 +0000 (11:36 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 18 May 2020 10:36:26 +0000 (11:36 +0100)
PR 25713
* bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
separators into DOS style when creating a WIN32 fullpath.

bfd/ChangeLog
bfd/bfdio.c

index 06a9f125af7247787ad8cd5ae30eed816a10377b..b3cefd94881421b5bd256c88faedd68ecf81f973 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-18  Jaydeep Chauhan  <jaydeepchauhan1494@gmail.com>
+
+       PR 25713
+       * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
+       separators into DOS style when creating a WIN32 fullpath.
+
 2020-05-14  Nelson Chu  <nelson.chu@sifive.com>
 
        * elfnn-riscv.c (elfNN_riscv_mkobject):  New function.  We need this
index 29834d9c6b69e017225c533b2c29f64f99b949a2..bba8d896d3a7849a8fd7449dec923b72a11458b0 100644 (file)
@@ -120,13 +120,22 @@ _bfd_real_fopen (const char *filename, const char *modes)
 
   if (filelen > MAX_PATH - 1)
     {
-      FILE *file;
-      char* fullpath = (char *) malloc (filelen + 8);
+      FILE * file;
+      char * fullpath = (char *) malloc (filelen + 8);
+      int    i;
 
       /* Add a Microsoft recommended prefix that
         will allow the extra-long path to work.  */
       strcpy (fullpath, "\\\\?\\");
       strcat (fullpath, filename);
+
+      /* Convert any UNIX style path separators into the DOS form.  */
+      for (i = 0, fullpath[i]; i++)
+        {
+          if (IS_UNIX_DIR_SEPARATOR (fullpath[i]))
+           fullpath[i] = '\\';
+        }
+
       file = close_on_exec (fopen (fullpath, modes));
       free (fullpath);
       return file;
This page took 0.026264 seconds and 4 git commands to generate.