]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
textual: improve error messages
authorSami Kerola <kerolasa@iki.fi>
Sun, 7 Dec 2014 10:13:03 +0000 (10:13 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Dec 2014 08:19:22 +0000 (09:19 +0100)
Use error printing facilities that add command name in front of the error
message, and add explanation that is part of existing translations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/blockdev.c
disk-utils/mkfs.c
disk-utils/mkfs.cramfs.c
text-utils/more.c

index efaa0ead274c819999b177d620dbe86025c56eda..43aaef6d6b2d8a0a811f5637a2a454eda5330542 100644 (file)
@@ -365,7 +365,7 @@ static void do_commands(int fd, char **argv, int d)
                }
 
                if (res == -1) {
-                       perror(bdcms[j].iocname);
+                       warn(_("ioctl error on %s"), bdcms[j].iocname);
                        if (verbose)
                                printf(_("%s failed.\n"), _(bdcms[j].help));
                        exit(EXIT_FAILURE);
index dbc938f1a39a467df3a762ac35d6d997533b70e0..8ad6065316e2a28804c3609baf6229a9e85f2674 100644 (file)
@@ -147,6 +147,5 @@ int main(int argc, char **argv)
 
        /* Execute the program */
        execvp(progname, argv + optind);
-       perror(progname);
-       return EXIT_FAILURE;
+       err(EXIT_FAILURE, _("failed to execute %s"), progname);
 }
index bae68ecb3706c1a33ce1b551b252fc99b2773b3f..509b50b9d5c88ac24962eff2e8b75814e1a50397 100644 (file)
@@ -328,7 +328,7 @@ static unsigned int parse_directory(struct entry *root_entry, const char *name,
                memcpy(endpath, dirent->d_name, namelen + 1);
 
                if (lstat(path, &st) < 0) {
-                       perror(endpath);
+                       warn(_("stat failed %s"), endpath);
                        warn_skip = 1;
                        continue;
                }
index a489953b555493ef770216d161e98ea11e2d9271..8c0853c14253caf5d18fbefe5fe1cd6e8e1aa233 100644 (file)
@@ -591,7 +591,7 @@ FILE *checkf(register char *fs, int *clearfirst)
                fflush(stdout);
                if (clreol)
                        cleareol();
-               perror(fs);
+               warn(_("stat failed %s"), fs);
                return ((FILE *)NULL);
        }
        if ((stbuf.st_mode & S_IFMT) == S_IFDIR) {
@@ -600,7 +600,7 @@ FILE *checkf(register char *fs, int *clearfirst)
        }
        if ((f = Fopen(fs, "r")) == NULL) {
                fflush(stdout);
-               perror(fs);
+               warn(_("cannot open %s"), fs);
                return ((FILE *)NULL);
        }
        if (magic(f, fs)) {
@@ -1781,10 +1781,8 @@ void initterm(void)
                        int tgrp;
                        /* Wait until we're in the foreground before we
                         * save the terminal modes. */
-                       if ((tgrp = tcgetpgrp(fileno(stdout))) < 0) {
-                               perror("tcgetpgrp");
-                               exit(EXIT_FAILURE);
-                       }
+                       if ((tgrp = tcgetpgrp(fileno(stdout))) < 0)
+                               err(EXIT_FAILURE, "tcgetpgrp");
                        if (tgrp != getpgrp(0)) {
                                kill(0, SIGTTOU);
                                goto retry;