]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
textual: standardize some "cannot read" and "seek failed" error messages
authorBenno Schulenberg <bensberg@justemail.net>
Tue, 8 Oct 2013 15:04:22 +0000 (17:04 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 9 Oct 2013 09:37:38 +0000 (11:37 +0200)
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
disk-utils/fsck.c
disk-utils/fsck.cramfs.c
lib/path.c
login-utils/last.c
login-utils/sulogin.c
sys-utils/setpriv.c

index 19eabe349a88d105365e2576f95561f6a2a9dc41..00622c428f67c7e7c82c89654c7bb7afa83a5992 100644 (file)
@@ -304,7 +304,7 @@ static int is_irrotational_disk(dev_t disk)
        rc = fscanf(f, "%d", &x);
        if (rc != 1) {
                if (ferror(f))
-                       warn(_("failed to read: %s"), path);
+                       warn(_("cannot read %s"), path);
                else
                        warnx(_("parse error: %s"), path);
        }
index 3c861d57d7167c9c5ce28c1a69cf5a7c857e88e2..cd23345e37b8c5569fe24241e01d353e920e90ec 100644 (file)
@@ -166,14 +166,14 @@ static void test_super(int *start, size_t * length)
 
        /* find superblock */
        if (read(fd, &super, sizeof(super)) != sizeof(super))
-               err(FSCK_EX_ERROR, _("read failed: %s"), filename);
+               err(FSCK_EX_ERROR, _("cannot read %s"), filename);
        if (get_superblock_endianness(super.magic) != -1)
                *start = 0;
        else if (*length >= (PAD_SIZE + sizeof(super))) {
                if (lseek(fd, PAD_SIZE, SEEK_SET) == (off_t) -1)
-                       err(FSCK_EX_ERROR, _("seek failed: %s"), filename);
+                       err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
                if (read(fd, &super, sizeof(super)) != sizeof(super))
-                       err(FSCK_EX_ERROR, _("read failed: %s"), filename);
+                       err(FSCK_EX_ERROR, _("cannot read %s"), filename);
                if (get_superblock_endianness(super.magic) != -1)
                        *start = PAD_SIZE;
                else
@@ -228,9 +228,9 @@ static void test_crc(int start)
                         MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
                if (buf != MAP_FAILED) {
                        if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
-                               err(FSCK_EX_ERROR, _("seek failed: %s"), filename);
+                               err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
                        if (read(fd, buf, super.size) < 0)
-                               err(FSCK_EX_ERROR, _("read failed: %s"), filename);
+                               err(FSCK_EX_ERROR, _("cannot read %s"), filename);
                }
        }
        if (buf != MAP_FAILED) {
@@ -244,11 +244,11 @@ static void test_crc(int start)
 
                buf = xmalloc(4096);
                if (lseek(fd, start, SEEK_SET) == (off_t) -1)
-                       err(FSCK_EX_ERROR, _("seek failed: %s"), filename);
+                       err(FSCK_EX_ERROR, _("seek on %s failed"), filename);
                for (;;) {
                        retval = read(fd, buf, 4096);
                        if (retval < 0)
-                               err(FSCK_EX_ERROR, _("read failed: %s"), filename);
+                               err(FSCK_EX_ERROR, _("cannot read %s"), filename);
                        else if (retval == 0)
                                break;
                        if (length == 0)
index 7a68d9fe2e708abe9bfc811648ed3c20b87e0251..1f7e25806c0644b8791514e9611ff68f5f429e78 100644 (file)
@@ -97,7 +97,7 @@ path_read_str(char *result, size_t len, const char *path, ...)
        va_end(ap);
 
        if (!fgets(result, len, fd))
-               err(EXIT_FAILURE, _("failed to read: %s"), pathbuf);
+               err(EXIT_FAILURE, _("cannot read %s"), pathbuf);
        fclose(fd);
 
        len = strlen(result);
@@ -118,7 +118,7 @@ path_read_s32(const char *path, ...)
 
        if (fscanf(fd, "%d", &result) != 1) {
                if (ferror(fd))
-                       err(EXIT_FAILURE, _("failed to read: %s"), pathbuf);
+                       err(EXIT_FAILURE, _("cannot read %s"), pathbuf);
                else
                        errx(EXIT_FAILURE, _("parse error: %s"), pathbuf);
        }
@@ -139,7 +139,7 @@ path_read_u64(const char *path, ...)
 
        if (fscanf(fd, "%"SCNu64, &result) != 1) {
                if (ferror(fd))
-                       err(EXIT_FAILURE, _("failed to read: %s"), pathbuf);
+                       err(EXIT_FAILURE, _("cannot read %s"), pathbuf);
                else
                        errx(EXIT_FAILURE, _("parse error: %s"), pathbuf);
        }
@@ -187,7 +187,7 @@ path_cpuparse(int maxcpus, int islist, const char *path, va_list ap)
        fd = path_vfopen("r" UL_CLOEXECSTR, 1, path, ap);
 
        if (!fgets(buf, len, fd))
-               err(EXIT_FAILURE, _("failed to read: %s"), pathbuf);
+               err(EXIT_FAILURE, _("cannot read %s"), pathbuf);
        fclose(fd);
 
        len = strlen(buf);
index 8da42bafbf3c8829ba98930bc4ce102c7c619093..5550dcb3f5bb5881f846fb2b10b9fc0442babd25 100644 (file)
@@ -186,12 +186,12 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,
                        return 0;
                o = ((fpos - 1) / UCHUNKSIZE) * UCHUNKSIZE;
                if (fseeko(fp, o, SEEK_SET) < 0) {
-                       warn(_("seek failed: %s"), ctl->altv[ctl->alti]);
+                       warn(_("seek on %s failed"), ctl->altv[ctl->alti]);
                        return 0;
                }
                bpos = (int)(fpos - o);
                if (fread(buf, bpos, 1, fp) != 1) {
-                       warn(_("read failed: %s"), ctl->altv[ctl->alti]);
+                       warn(_("cannot read %s"), ctl->altv[ctl->alti]);
                        return 0;
                }
                fpos = o;
@@ -220,7 +220,7 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,
         */
        memcpy(tmp + (-bpos), buf, utsize + bpos);
        if (fseeko(fp, fpos, SEEK_SET) < 0) {
-               warn(_("seek failed: %s"), ctl->altv[ctl->alti]);
+               warn(_("seek on %s failed"), ctl->altv[ctl->alti]);
                return 0;
        }
 
@@ -228,7 +228,7 @@ static int uread(const struct last_control *ctl, FILE *fp, struct utmp *u,
         *      Read another UCHUNKSIZE bytes.
         */
        if (fread(buf, UCHUNKSIZE, 1, fp) != 1) {
-               warn(_("read failed: %s"), ctl->altv[ctl->alti]);
+               warn(_("cannot read %s"), ctl->altv[ctl->alti]);
                return 0;
        }
 
index 352c7818efa4a82b4d07a1955a43d6f2b1ee6701..4560ee0fbe1432412e91aee1f3f71d1fff382950 100644 (file)
@@ -602,7 +602,7 @@ static char *getpasswd(struct console *con)
                        case ENOENT:
                                break;
                        default:
-                               warn(_("%s: read failed"), con->tty);
+                               warn(_("cannot read %s"), con->tty);
                                break;
                        }
                        goto quit;
index a5727361ad9876870e9ff8cfcd8cd06bed8ecf11..c3f2a8b82d09231608ca20657009c4666a8e5eed 100644 (file)
@@ -230,7 +230,7 @@ static void dump_label(const char *name)
        close(fd);
        if (len < 0) {
                errno = e;
-               warn(_("read failed: %s"), name);
+               warn(_("cannot read %s"), name);
                return;
        }
        if (sizeof(buf) - 1 <= (size_t)len) {