From 10f16d646e146b215471c56ed6b7e0c2d78e5719 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 13 Feb 2012 20:50:03 +0100 Subject: [PATCH] First cut wild card in restore cd command -- works in one component only --- bacula/src/dird/ua_tree.c | 5 +++++ bacula/src/lib/tree.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 84c0898585..d471cfad16 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -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 */ diff --git a/bacula/src/lib/tree.c b/bacula/src/lib/tree.c index 4d6cac1d3c..633865e627 100644 --- a/bacula/src/lib/tree.c +++ b/bacula/src/lib/tree.c @@ -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; -- 2.39.5