]> git.sur5r.net Git - bacula/bacula/commitdiff
First cut wild card in restore cd command -- works in one component only
authorKern Sibbald <kern@sibbald.com>
Mon, 13 Feb 2012 19:50:03 +0000 (20:50 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:32 +0000 (14:50 +0200)
bacula/src/dird/ua_tree.c
bacula/src/lib/tree.c

index 84c0898585efa0335919bece58440f5625e374a2..d471cfad160b1f7e36b95c4112a675276c8a9e90 100644 (file)
@@ -798,6 +798,11 @@ static int cdcmd(UAContext *ua, TREE_CTX *tree)
       ua->error_msg(_("Too few or too many arguments. Try using double quotes.\n"));
       return 1;
    }
+   if (!tree_node_has_child(tree->node)) {
+      ua->send_msg(_("Node %s has no children.\n"), tree->node->fname);
+      return 1;
+   }
+
    node = tree_cwd(ua->argk[1], tree->root, tree->node);
    if (!node) {
       /* Try once more if Win32 drive -- make absolute */
index 4d6cac1d3c22e49859ebe45b100cb517e9b30bd0..633865e627768e588cbaf86451b93d4385e76bbb 100644 (file)
@@ -426,6 +426,9 @@ TREE_NODE *tree_relcwd(char *path, TREE_ROOT *root, TREE_NODE *node)
           && strncmp(cd->fname, path, len) == 0) {
          break;
       }
+      if (fnmatch(path, cd->fname, len) == 0) {
+         break;
+      }
    }
    if (!cd || (cd->type == TN_FILE && !tree_node_has_child(cd))) {
       return NULL;