]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - e2fsck/util.c
Merge branch 'maint' into next
[thirdparty/e2fsprogs.git] / e2fsck / util.c
index a297e58f1a247e5726729db92a7175a28bd485e3..db6a1cc11a23c309bd71427d870720eaf8491014 100644 (file)
@@ -204,9 +204,10 @@ int ask_yn(e2fsck_t ctx, const char * string, int def)
        static int      yes_answers;
 
 #ifdef HAVE_TERMIOS_H
-       struct termios  termios = {0, }, tmp;
+       struct termios  termios, tmp;
 
-       tcgetattr (0, &termios);
+       if (tcgetattr (0, &termios) < 0)
+               memset(&termios, 0, sizeof(termios));
        tmp = termios;
        tmp.c_lflag &= ~(ICANON | ECHO);
        tmp.c_cc[VMIN] = 1;
@@ -735,7 +736,7 @@ int check_for_modules(const char *fs_name)
 
 /*
  * Helper function that does the right thing if write returns a
- * partial write, or an EGAIN/EINTR error.
+ * partial write, or an EAGAIN/EINTR error.
  */
 int write_all(int fd, char *buf, size_t count)
 {
@@ -756,16 +757,28 @@ int write_all(int fd, char *buf, size_t count)
        return c;
 }
 
-void dump_mmp_msg(struct mmp_struct *mmp, const char *msg)
+void dump_mmp_msg(struct mmp_struct *mmp, const char *fmt, ...)
 {
+       va_list pvar;
 
-       if (msg)
-               printf("MMP check failed: %s\n", msg);
+       if (fmt) {
+               printf("MMP check failed: ");
+               va_start(pvar, fmt);
+               vprintf(fmt, pvar);
+               va_end(pvar);
+       }
        if (mmp) {
                time_t t = mmp->mmp_time;
 
-               printf("MMP error info: last update: %s node: %s device: %s\n",
-                      ctime(&t), mmp->mmp_nodename, mmp->mmp_bdevname);
+               printf("MMP_block:\n");
+               printf("    mmp_magic: 0x%x\n", mmp->mmp_magic);
+               printf("    mmp_check_interval: %d\n",
+                      mmp->mmp_check_interval);
+               printf("    mmp_sequence: %08x\n", mmp->mmp_seq);
+               printf("    mmp_update_date: %s", ctime(&t));
+               printf("    mmp_update_time: %lld\n", mmp->mmp_time);
+               printf("    mmp_node_name: %s\n", mmp->mmp_nodename);
+               printf("    mmp_device_name: %s\n", mmp->mmp_bdevname);
        }
 }