]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/error.c
flake.nix: add missing bindgen output hash
[bcachefs-tools-debian] / libbcachefs / error.c
index aa640284ed1990e575917229ba6340a0546fde08..b08cd23dee00576640a0919b401d1c5729a1af61 100644 (file)
@@ -85,12 +85,13 @@ enum ask_yn bch2_fsck_ask_yn(void)
        bool ret;
 
        while (true) {
-               fputs(" (y,n,Y,N) ", stdout);
+               fputs(" (y,n, or Y,N for all errors of this type) ", stdout);
                fflush(stdout);
 
                if (getline(&buf, &buflen, stdin) < 0)
                        die("error reading from standard input");
 
+               strim(buf);
                if (strlen(buf) != 1)
                        continue;
 
@@ -158,6 +159,11 @@ int bch2_fsck_err(struct bch_fs *c, unsigned flags, const char *fmt, ...)
        mutex_lock(&c->fsck_error_lock);
        s = fsck_err_get(c, fmt);
        if (s) {
+               /*
+                * We may be called multiple times for the same error on
+                * transaction restart - this memoizes instead of asking the user
+                * multiple times for the same error:
+                */
                if (s->last_msg && !strcmp(buf.buf, s->last_msg)) {
                        ret = s->ret;
                        mutex_unlock(&c->fsck_error_lock);