]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/findlib/create_file.c
take out 260char limit for win NT/XP, etc. paths can become 32K characters long now.
[bacula/bacula] / bacula / src / findlib / create_file.c
index 8f65b909613316c57d6cfe4cc141ed1d9345f145..0cea7be666d01ff8195e4a1a2c3a227e0bec56b3 100644 (file)
@@ -176,23 +176,36 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
             Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
             bclose(bfd);
          }
+      
+
+         if ((bopen(bfd, attr->ofname, mode, S_IRUSR | S_IWUSR)) < 0) {
+            berrno be;
+            be.set_errno(bfd->berrno);
+            Qmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"),
+                  attr->ofname, be.strerror());
+            return CF_ERROR;
+         }
+
+         /* this doesn't solve the Microsoft problem - Thorsten Engel 
+            so I reused the code of V 1.40
          /*
           * If the open fails, we attempt to cd into the directory
           *  and create the file with a relative path rather than
           *  the full absolute path.  This is for Win32 where
           *  path names may be too long to create.
           */
+         /*
          if ((bopen(bfd, attr->ofname, mode, S_IRUSR | S_IWUSR)) < 0) {
             berrno be;
             int stat;
             Dmsg2(000, "bopen failed errno=%d: ERR=%s\n", bfd->berrno,  
-               be.strerror(bfd->berrno));
-            if (strlen(attr->ofname) > 250) {   /* Microsoft limitation */
+               be.strerror(bfd->berrno));            
+            if (strlen(attr->ofname) > 250) {   // Microsoft limitation 
                char savechr;
                char *p, *e;
                struct saved_cwd cwd;
                savechr = attr->ofname[pnl];
-               attr->ofname[pnl] = 0;                 /* terminate path */
+               attr->ofname[pnl] = 0;                 // terminate path 
                Dmsg1(000, "Do chdir %s\n", attr->ofname);
                if (save_cwd(&cwd) != 0) {
                   Qmsg0(jcr, M_ERROR, 0, _("Could not save_dirn"));
@@ -239,8 +252,8 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
             }
             Qmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"),
                   attr->ofname, be.strerror(bfd->berrno));
-            return CF_ERROR;
-         }
+            return CF_ERROR; 
+         }*/
          return CF_EXTRACT;
 #ifndef HAVE_WIN32  // none of these exists on MS Windows
       case FT_RAW:                    /* Bacula raw device e.g. /dev/sda1 */