Whamcloud - gitweb
e2fsck: map PROMPT_* values to prompt messages
[tools/e2fsprogs.git] / misc / e2initrd_helper.c
index 3d9f5ab..436aab8 100644 (file)
@@ -9,6 +9,7 @@
  * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <unistd.h>
 #ifdef HAVE_STDLIB_H
@@ -34,12 +35,12 @@ extern char *optarg;
 #include "ext2fs/ext2_fs.h"
 #include "ext2fs/ext2fs.h"
 #include "blkid/blkid.h"
+#include "support/nls-enable.h"
 
 #include "../version.h"
-#include "nls-enable.h"
 
-const char * program_name = "get_fstab";
-char * device_name;
+static const char * program_name = "e2initrd_helper";
+static char * device_name;
 static int open_flag;
 static int root_type;
 static blkid_cache cache = NULL;
@@ -305,6 +306,7 @@ static void PRS(int argc, char **argv)
        setlocale(LC_CTYPE, "");
        bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
        textdomain(NLS_CAT_NAME);
+       set_com_err_gettext(gettext);
 #endif
 
        while ((c = getopt(argc, argv, "rv")) != EOF) {
@@ -325,7 +327,7 @@ static void PRS(int argc, char **argv)
                usage();
        device_name = blkid_get_devname(NULL, argv[optind], NULL);
        if (!device_name) {
-               com_err("tune2fs", 0, _("Unable to resolve '%s'"),
+               com_err(program_name, 0, _("Unable to resolve '%s'"),
                        argv[optind]);
                exit(1);
        }
@@ -340,6 +342,10 @@ static void get_root_type(ext2_filsys fs)
        int             ret;
 
        retval = get_file(fs, "/etc/fstab", &file);
+       if (retval) {
+               com_err(program_name, retval, "couldn't open /etc/fstab");
+               exit(1);
+       }
 
        while (!mem_file_eof(&file)) {
                buf = get_line(&file);