]> git.sur5r.net Git - bacula/bacula/commitdiff
Backport bbatch patch + tweak Win32 mount point code
authorKern Sibbald <kern@sibbald.com>
Sun, 23 Mar 2008 10:53:17 +0000 (10:53 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 23 Mar 2008 10:53:17 +0000 (10:53 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6671 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/tools/bbatch.c
bacula/src/win32/compat/compat.cpp

index b42ce0c8f35406b1178fc5f0922c9c337fbea58a..f2e1e7297af1f0fa2bcc8ef0a7fdc7cb75a9b37b 100644 (file)
@@ -143,9 +143,9 @@ int main (int argc, char *argv[])
          break;
 
       case 'f':
-        if (nb < 10 ) {
-           files[nb++] = optarg;
-        }
+         if (nb < 10 ) {
+            files[nb++] = optarg;
+         }
          break;
 
       case '?':
@@ -192,15 +192,15 @@ int main (int argc, char *argv[])
       pm_strcpy(bjcr->fileset_md5, "Dummy.fileset.md5");
       
       if ((db=db_init_database(NULL, db_name, db_user, db_password,
-                              db_host, 0, NULL, 0)) == NULL) {
-        Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
+                               db_host, 0, NULL, 0)) == NULL) {
+         Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
       }
       if (!db_open_database(NULL, db)) {
-        Emsg0(M_ERROR_TERM, 0, db_strerror(db));
+         Emsg0(M_ERROR_TERM, 0, db_strerror(db));
       }
       Dmsg0(200, "Database opened\n");
       if (verbose) {
-        Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
+         Pmsg2(000, _("Using Database: %s, User: %s\n"), db_name, db_user);
       }
       
       bjcr->db = db;
@@ -225,23 +225,23 @@ static void fill_attr(ATTR_DBR *ar, char *data)
 
    for(p = b = data; *p; p++) {
       if (*p == ';') {
-        *p = '\0';
-        switch (index) {
-        case 0:
-           ar->FileIndex = str_to_int64(b);
-           break;
-        case 1:
-           ar->fname = b;
-           break;
-        case 2:
-           ar->attr = b;
-           break;
-        case 3:
-           ar->Digest = b;
-           break;
-        }
-        index++;
-        b = ++p;
+         *p = '\0';
+         switch (index) {
+         case 0:
+            ar->FileIndex = str_to_int64(b);
+            break;
+         case 1:
+            ar->fname = b;
+            break;
+         case 2:
+            ar->attr = b;
+            break;
+         case 3:
+            ar->Digest = b;
+            break;
+         }
+         index++;
+         b = ++p;
       }
    }
 }
@@ -264,11 +264,11 @@ static void *do_batch(void *jcr)
       strip_trailing_newline(data);
       lineno++;
       if (verbose && ((lineno % 5000) == 1)) {
-        printf("\r%i", lineno);
+         printf("\r%i", lineno);
       }
       fill_attr(&ar, data);
       if (!db_create_file_attributes_record(bjcr, bjcr->db, &ar)) {
-        Emsg0(M_ERROR_TERM, 0, _("Error while inserting file\n"));
+         Emsg0(M_ERROR_TERM, 0, _("Error while inserting file\n"));
       }
    }
    fclose(fd);
@@ -278,9 +278,9 @@ static void *do_batch(void *jcr)
    P(mutex);
    char ed1[200], ed2[200];
    printf("\rbegin = %s, end = %s\n", edit_int64(begin, ed1),edit_int64(end, ed2));
-   printf("Insert time = %llims\n", (end - begin) / 10000);
+   printf("Insert time = %sms\n", edit_int64((end - begin) / 10000, ed1));
    printf("Create %u files at %.2f/s\n", lineno, 
-         (lineno / ((float)((end - begin) / 1000000))));
+          (lineno / ((float)((end - begin) / 1000000))));
    nb--;
    V(mutex);
    pthread_exit(NULL);
index 175aaef3541b7d2836edb6f71e1de8a8479a32c2..f549e266127820def0fe6131a90919d56822d461 100644 (file)
@@ -765,8 +765,9 @@ stat2(const char *file, struct stat *sb)
    rval = fstat((int)h, sb);
    CloseHandle(h);
 
-   if (attr & FILE_ATTRIBUTE_DIRECTORY) {
-      return statDir(file, sb);
+   if (attr & FILE_ATTRIBUTE_DIRECTORY &&
+        file[1] == ':' && file[2] != 0) {
+      statDir(file, sb);
    }
 
    return rval;
@@ -839,7 +840,7 @@ stat(const char *file, struct stat *sb)
     */
    if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && 
         file[1] == ':' && file[2] != 0) {
-      return statDir(file, sb);
+      statDir(file, sb);
    }
    return 0;
 }