From 65b01dcc5a6a261227faeaeb7a182a619d1ce4cc Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 2 Dec 2011 12:52:15 -0500 Subject: btrfs-progs: fix regexec to only work if we actually have a regexec We were unconditionally executing our regular expression, even though we may not have one, so check to make sure mreg is not null before calling regexec. Thanks, Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Chris Mason --- cmds-restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-restore.c b/cmds-restore.c index 1aae3902..3be6e719 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -649,7 +649,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key, /* full path from root of btrfs being restored */ snprintf(fs_name, 4096, "%s/%s", dir, filename); - if (REG_NOMATCH == regexec(mreg, fs_name, 0, NULL, 0)) + if (mreg && REG_NOMATCH == regexec(mreg, fs_name, 0, NULL, 0)) goto next; /* full path from system root */ -- cgit v1.2.3