Skip to content
Permalink
Browse files

Update cmds-restore.c

Attempt to fix Issue kdave#59
  • Loading branch information
unquietwiki committed Jun 1, 2019
1 parent 4301342 commit 6f4959237077b8fc95339167ecdd07241c8db937
Showing with 9 additions and 3 deletions.
  1. +9 −3 cmds-restore.c
@@ -58,6 +58,7 @@ static int ignore_errors = 0;
static int overwrite = 0;
static int get_xattrs = 0;
static int dry_run = 0;
static int skip_loops = 0;

#define LZO_LEN 4
#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
@@ -483,7 +484,8 @@ static int copy_one_extent(struct btrfs_root *root, int fd,
enum loop_response {
LOOP_STOP,
LOOP_CONTINUE,
LOOP_DONTASK
LOOP_DONTASK,
LOOP_SKIP
};

static enum loop_response ask_to_continue(const char *file)
@@ -492,13 +494,17 @@ static enum loop_response ask_to_continue(const char *file)
char *ret;

printf("We seem to be looping a lot on %s, do you want to keep going "
"on ? (y/N/a): ", file);
"on ? (y/N/a/I): ", file);
again:
ret = fgets(buf, 2, stdin);
if (*ret == '\n' || tolower(*ret) == 'n')
return LOOP_STOP;
if (tolower(*ret) == 'a')
return LOOP_DONTASK;
if (tolower(*ret) == 'i') {
skip_loops = 1;
return LOOP_SKIP;
}
if (tolower(*ret) != 'y') {
printf("Please enter one of 'y', 'n', or 'a': ");
goto again;
@@ -729,7 +735,7 @@ static int copy_file(struct btrfs_root *root, int fd, struct btrfs_key *key,
}

while (1) {
if (loops >= 0 && loops++ >= 1024) {
if (loops >= 0 && loops++ >= 1024 && skip_loops == 0) {
enum loop_response resp;

resp = ask_to_continue(file);

0 comments on commit 6f49592

Please sign in to comment.
You can’t perform that action at this time.