Whamcloud - gitweb
tune2fs: fix an error message
[tools/e2fsprogs.git] / misc / tune2fs.c
index 4200104..f3ce443 100644 (file)
@@ -59,6 +59,7 @@ extern int optind;
 #include "et/com_err.h"
 #include "support/plausible.h"
 #include "support/quotaio.h"
+#include "support/devname.h"
 #include "uuid/uuid.h"
 #include "e2p/e2p.h"
 #include "util.h"
@@ -1677,8 +1678,9 @@ static int handle_quota_options(ext2_filsys fs)
                if (quota_enable[qtype] == QOPT_ENABLE &&
                    *quota_sb_inump(fs->super, qtype) == 0) {
                        if ((qf_ino = quota_file_exists(fs, qtype)) > 0) {
-                               retval = quota_update_limits(qctx, qf_ino,
-                                                            qtype);
+                               retval = quota_read_all_dquots(qctx, qf_ino,
+                                                              qtype,
+                                                              QREAD_LIMITS);
                                if (retval) {
                                        com_err(program_name, retval,
                                                _("while updating quota limits (%d)"),
@@ -1773,7 +1775,7 @@ static void parse_e2label_options(int argc, char ** argv)
        io_options = strchr(argv[1], '?');
        if (io_options)
                *io_options++ = 0;
-       device_name = blkid_get_devname(NULL, argv[1], NULL);
+       device_name = get_devname(NULL, argv[1], NULL);
        if (!device_name) {
                com_err("e2label", 0, _("Unable to resolve '%s'"),
                        argv[1]);
@@ -2073,7 +2075,7 @@ static void parse_tune2fs_options(int argc, char **argv)
        io_options = strchr(argv[optind], '?');
        if (io_options)
                *io_options++ = 0;
-       device_name = blkid_get_devname(NULL, argv[optind], NULL);
+       device_name = get_devname(NULL, argv[optind], NULL);
        if (!device_name) {
                com_err(program_name, 0, _("Unable to resolve '%s'"),
                        argv[optind]);
@@ -2950,6 +2952,8 @@ int tune2fs_main(int argc, char **argv)
 #endif
        if (argc && *argv)
                program_name = *argv;
+       else
+               usage();
        add_error_table(&et_ext2_error_table);
 
 #ifdef CONFIG_BUILD_FINDFS
@@ -3101,9 +3105,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
                if (retval) {
                        com_err("tune2fs", retval,
                                "while recovering journal.\n");
-                       printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
-                       if (fs)
-                               ext2fs_close_free(&fs);
+                       printf(_("Please run e2fsck -fy %s.\n"), device_name);
+                       if (!fs)
+                               exit(1);
                        rc = 1;
                        goto closefs;
                }
@@ -3241,6 +3245,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
                        fputs(_("Error in using clear_mmp. "
                                "It must be used with -f\n"),
                              stderr);
+                       rc = 1;
                        goto closefs;
                }
        }
@@ -3445,5 +3450,5 @@ closefs:
 
        if (feature_64bit)
                convert_64bit(fs, feature_64bit);
-       return (ext2fs_close_free(&fs) ? 1 : 0);
+       return (ext2fs_close_free(&fs) ? 1 : rc);
 }