summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/TODO3
-rw-r--r--disk-utils/fsck.minix.c2
-rw-r--r--disk-utils/raw.c14
-rw-r--r--fdisk/fdisk.c4
-rw-r--r--fdisk/gpt.c3
-rw-r--r--hwclock/cmos.c16
-rw-r--r--include/c.h2
-rw-r--r--libblkid/src/devname.c3
-rw-r--r--libblkid/src/verify.c8
-rw-r--r--libmount/src/context.c2
-rw-r--r--login-utils/login.c3
-rw-r--r--login-utils/vipw.c3
-rw-r--r--misc-utils/blkid.c2
-rw-r--r--misc-utils/uuidd.c25
-rw-r--r--mount/fstab.c2
-rw-r--r--mount/lomount.c3
-rw-r--r--mount/mount.c7
-rw-r--r--mount/umount.c10
-rw-r--r--sys-utils/chcpu.c12
-rw-r--r--sys-utils/readprofile.c8
-rw-r--r--term-utils/ttymsg.c2
21 files changed, 55 insertions, 79 deletions
diff --git a/Documentation/TODO b/Documentation/TODO
index 555f80d2f..4620e8a91 100644
--- a/Documentation/TODO
+++ b/Documentation/TODO
@@ -149,9 +149,6 @@ login-utils:
libblkid
--------
- - remove strerrr() from debug messages (use %m) to make BLKID_DEBUG= output
- thread-safe
-
- (!) don't use internally blkid_loff_t, rather use off_t, size_t, ssize_t,
stdint.h types and so on...
diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index 0c6cfa4c5..eb02f9ea6 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -1306,7 +1306,7 @@ main(int argc, char ** argv) {
}
IN = open(device_name,repair?O_RDWR:O_RDONLY);
if (IN < 0)
- die(_("unable to open '%s': %s"), device_name, strerror(errno));
+ die(_("unable to open '%s': %m"), device_name);
for (count=0 ; count<3 ; count++)
sync();
read_superblock();
diff --git a/disk-utils/raw.c b/disk-utils/raw.c
index 4cb74ca6f..84a71ecd7 100644
--- a/disk-utils/raw.c
+++ b/disk-utils/raw.c
@@ -142,8 +142,8 @@ int main(int argc, char *argv[])
err = stat(block_name, &statbuf);
if (err) {
fprintf (stderr,
- _("Cannot locate block device '%s' (%s)\n"),
- block_name, strerror(errno));
+ _("Cannot locate block device '%s' (%m)\n"),
+ block_name);
exit(2);
}
@@ -201,8 +201,8 @@ static int query(int minor_raw, const char *raw_name, int quiet)
err = stat(raw_name, &statbuf);
if (err) {
- fprintf (stderr, _("Cannot locate raw device '%s' (%s)\n"),
- raw_name, strerror(errno));
+ fprintf (stderr, _("Cannot locate raw device '%s' (%m)\n"),
+ raw_name);
exit(2);
}
@@ -227,8 +227,7 @@ static int query(int minor_raw, const char *raw_name, int quiet)
if (has_worked && errno == EINVAL)
return 0;
fprintf (stderr,
- _("Error querying raw device (%s)\n"),
- strerror(errno));
+ _("Error querying raw device (%m)\n"));
exit(3);
}
/* If one query has worked, mark that fact so that we don't
@@ -253,8 +252,7 @@ static int bind(int minor_raw, int block_major, int block_minor)
err = ioctl(master_fd, RAW_SETBIND, &rq);
if (err < 0) {
fprintf (stderr,
- _("Error setting raw device (%s)\n"),
- strerror(errno));
+ _("Error setting raw device (%m)\n"));
exit(3);
}
printf (_("%sraw%d: bound to major %d, minor %d\n"),
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 1c1f49211..249de7101 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -2631,10 +2631,10 @@ reread_partition_table(int leave) {
}
if (i) {
- printf(_("\nWARNING: Re-reading the partition table failed with error %d: %s.\n"
+ printf(_("\nWARNING: Re-reading the partition table failed with error %d: %m.\n"
"The kernel still uses the old table. The new table will be used at\n"
"the next reboot or after you run partprobe(8) or kpartx(8)\n"),
- errno, strerror(errno));
+ errno);
}
if (dos_changed)
diff --git a/fdisk/gpt.c b/fdisk/gpt.c
index ff659fd8e..aeacd6624 100644
--- a/fdisk/gpt.c
+++ b/fdisk/gpt.c
@@ -106,8 +106,7 @@ last_lba(int fd)
rc = fstat(fd, &s);
if (rc == -1)
{
- fprintf(stderr, "last_lba() could not stat: %s\n",
- strerror(errno));
+ fprintf(stderr, "last_lba() could not stat: %m\n");
return 0;
}
if (S_ISBLK(s.st_mode))
diff --git a/hwclock/cmos.c b/hwclock/cmos.c
index 09b1555dd..90da9874e 100644
--- a/hwclock/cmos.c
+++ b/hwclock/cmos.c
@@ -316,13 +316,13 @@ static inline unsigned long cmos_read(unsigned long reg)
lseek(dev_port_fd, clock_ctl_addr, 0);
if (write(dev_port_fd, &v, 1) == -1 && debug)
printf(_
- ("cmos_read(): write to control address %X failed: %s\n"),
- clock_ctl_addr, strerror(errno));
+ ("cmos_read(): write to control address %X failed: %m\n"),
+ clock_ctl_addr);
lseek(dev_port_fd, clock_data_addr, 0);
if (read(dev_port_fd, &v, 1) == -1 && debug)
printf(_
- ("cmos_read(): read data address %X failed: %s\n"),
- clock_data_addr, strerror(errno));
+ ("cmos_read(): read data address %X failed: %m\n"),
+ clock_data_addr);
return v;
} else {
/*
@@ -359,14 +359,14 @@ static inline unsigned long cmos_write(unsigned long reg, unsigned long val)
lseek(dev_port_fd, clock_ctl_addr, 0);
if (write(dev_port_fd, &v, 1) == -1 && debug)
printf(_
- ("cmos_write(): write to control address %X failed: %s\n"),
- clock_ctl_addr, strerror(errno));
+ ("cmos_write(): write to control address %X failed: %m\n"),
+ clock_ctl_addr);
v = (val & 0xff);
lseek(dev_port_fd, clock_data_addr, 0);
if (write(dev_port_fd, &v, 1) == -1 && debug)
printf(_
- ("cmos_write(): write to data address %X failed: %s\n"),
- clock_data_addr, strerror(errno));
+ ("cmos_write(): write to data address %X failed: %m\n"),
+ clock_data_addr);
} else {
outb(reg, clock_ctl_addr);
outb(val, clock_data_addr);
diff --git a/include/c.h b/include/c.h
index 74d34608d..f5b4bcd44 100644
--- a/include/c.h
+++ b/include/c.h
@@ -153,7 +153,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
fprintf(stderr, ": ");
}
if (adderr)
- fprintf(stderr, "%s", strerror(errno));
+ fprintf(stderr, "%m");
fprintf(stderr, "\n");
if (doexit)
exit(excode);
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index f824a1795..42a8c19a9 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -260,8 +260,7 @@ static dev_t lvm_get_devno(const char *lvm_device)
DBG(DEBUG_DEVNAME, printf("opening %s\n", lvm_device));
if ((lvf = fopen(lvm_device, "r")) == NULL) {
- DBG(DEBUG_DEVNAME, printf("%s: (%d) %s\n", lvm_device, errno,
- strerror(errno)));
+ DBG(DEBUG_DEVNAME, printf("%s: (%d) %m\n", lvm_device, errno));
return 0;
}
diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c
index a0cb3fea2..49cc6f173 100644
--- a/libblkid/src/verify.c
+++ b/libblkid/src/verify.c
@@ -60,8 +60,8 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
if (stat(dev->bid_name, &st) < 0) {
DBG(DEBUG_PROBE,
- printf("blkid_verify: error %s (%d) while "
- "trying to stat %s\n", strerror(errno), errno,
+ printf("blkid_verify: error %m (%d) while "
+ "trying to stat %s\n", errno,
dev->bid_name));
open_err:
if ((errno == EPERM) || (errno == EACCES) || (errno == ENOENT)) {
@@ -113,8 +113,8 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
fd = open(dev->bid_name, O_RDONLY);
if (fd < 0) {
- DBG(DEBUG_PROBE, printf("blkid_verify: error %s (%d) while "
- "opening %s\n", strerror(errno), errno,
+ DBG(DEBUG_PROBE, printf("blkid_verify: error %m (%d) while "
+ "opening %s\n", errno,
dev->bid_name));
goto open_err;
}
diff --git a/libmount/src/context.c b/libmount/src/context.c
index e3158e48f..47d3f85ce 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -1734,7 +1734,7 @@ int test_mount(struct libmnt_test *ts, int argc, char *argv[])
rc = mnt_context_mount(cxt);
if (rc)
- printf("failed to mount %s\n", strerror(errno));
+ printf("failed to mount: %m\n");
else
printf("successfully mounted\n");
diff --git a/login-utils/login.c b/login-utils/login.c
index de56f2dcd..966233669 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -198,8 +198,7 @@ opentty(const char * tty) {
fd = open(tty, O_RDWR | O_NONBLOCK);
if (fd == -1) {
- syslog(LOG_ERR, _("FATAL: can't reopen tty: %s"),
- strerror(errno));
+ syslog(LOG_ERR, _("FATAL: can't reopen tty: %m"));
sleepexit(EXIT_FAILURE);
}
diff --git a/login-utils/vipw.c b/login-utils/vipw.c
index d3ae51ef9..ddca49a5f 100644
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -173,8 +173,7 @@ pw_lock(void) {
lockfd = open(orig_file, O_RDONLY, 0);
if (lockfd < 0) {
- (void)fprintf(stderr, "%s: %s: %s\n",
- progname, orig_file, strerror(errno));
+ (void)fprintf(stderr, "%s: %s: %m\n", progname, orig_file);
unlink(tmp_file);
exit(EXIT_FAILURE);
}
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
index a850ac9bd..3608304a5 100644
--- a/misc-utils/blkid.c
+++ b/misc-utils/blkid.c
@@ -504,7 +504,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
fd = open(devname, O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "error: %s: %s\n", devname, strerror(errno));
+ fprintf(stderr, "error: %s: %m\n", devname);
return 2;
}
if (blkid_probe_set_device(pr, fd, offset, size))
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 453287c5b..492ae4d03 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -223,8 +223,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
fd_pidfile = open(pidfile_path, O_CREAT | O_RDWR, 0664);
if (fd_pidfile < 0) {
if (!quiet)
- fprintf(stderr, _("Failed to open/create %s: %s\n"),
- pidfile_path, strerror(errno));
+ fprintf(stderr, _("Failed to open/create %s: %m\n"),
+ pidfile_path);
exit(EXIT_FAILURE);
}
cleanup_pidfile = pidfile_path;
@@ -240,8 +240,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
if ((errno == EAGAIN) || (errno == EINTR))
continue;
if (!quiet)
- fprintf(stderr, _("Failed to lock %s: %s\n"),
- pidfile_path, strerror(errno));
+ fprintf(stderr, _("Failed to lock %s: %m\n"), pidfile_path);
exit(EXIT_FAILURE);
}
ret = call_daemon(socket_path, 0, reply_buf, sizeof(reply_buf), 0, 0);
@@ -255,8 +254,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
if (!quiet)
- fprintf(stderr, _("Couldn't create unix stream "
- "socket: %s"), strerror(errno));
+ fprintf(stderr, _("Couldn't create unix stream socket: %m"));
exit(EXIT_FAILURE);
}
@@ -282,8 +280,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
sizeof(struct sockaddr_un)) < 0) {
if (!quiet)
fprintf(stderr,
- _("Couldn't bind unix socket %s: %s\n"),
- socket_path, strerror(errno));
+ _("Couldn't bind unix socket %s: %m\n"), socket_path);
exit(EXIT_FAILURE);
}
umask(save_umask);
@@ -291,8 +288,7 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
if (listen(s, SOMAXCONN) < 0) {
if (!quiet)
fprintf(stderr, _("Couldn't listen on unix "
- "socket %s: %s\n"), socket_path,
- strerror(errno));
+ "socket %s: %m\n"), socket_path);
exit(EXIT_FAILURE);
}
@@ -539,8 +535,7 @@ int main(int argc, char **argv)
ret = call_daemon(socket_path, do_type + 2, buf,
sizeof(buf), &num, &err_context);
if (ret < 0) {
- printf(_("Error calling uuidd daemon (%s): %s\n"),
- err_context, strerror(errno));
+ printf(_("Error calling uuidd daemon (%s): %m\n"), err_context);
return EXIT_FAILURE;
}
if (do_type == UUIDD_OP_TIME_UUID) {
@@ -568,8 +563,7 @@ int main(int argc, char **argv)
ret = call_daemon(socket_path, do_type, (char *) &uu,
sizeof(uu), 0, &err_context);
if (ret < 0) {
- printf(_("Error calling uuidd daemon (%s): %s\n"),
- err_context, strerror(errno));
+ printf(_("Error calling uuidd daemon (%s): %m\n"), err_context);
return EXIT_FAILURE;
}
if (ret != sizeof(uu))
@@ -589,8 +583,7 @@ int main(int argc, char **argv)
if (!quiet)
fprintf(stderr,
_("Couldn't kill uuidd running "
- "at pid %d: %s\n"), do_kill,
- strerror(errno));
+ "at pid %d: %m\n"), do_kill);
return EXIT_FAILURE;
}
if (!quiet)
diff --git a/mount/fstab.c b/mount/fstab.c
index 6c0e89f30..078401ccc 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -1103,7 +1103,7 @@ main(int argc, char **argv)
nloops = atoi(argv[4]);
if (stat(filename, &st) < -1)
- die(EXIT_FAILURE, "%s: %s\n", filename, strerror(errno));
+ die(EXIT_FAILURE, "%s: %m\n", filename);
fprintf(stderr, "%05d (pid=%05d): START\n", id, pid);
diff --git a/mount/lomount.c b/mount/lomount.c
index 74a874929..ff99413e9 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -875,8 +875,7 @@ set_loop(const char *device, const char *file, unsigned long long offset,
if (errno == EBUSY) {
if (verbose)
- printf(_("ioctl LOOP_SET_FD failed: %s\n"),
- strerror(errno));
+ printf(_("ioctl LOOP_SET_FD failed: %m\n"));
rc = 2;
} else
perror("ioctl: LOOP_SET_FD");
diff --git a/mount/mount.c b/mount/mount.c
index d2ecb1de6..d74da2c74 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -781,10 +781,10 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
int i = 0;
if (setgid(getgid()) < 0)
- die(EX_FAIL, _("mount: cannot set group id: %s"), strerror(errno));
+ die(EX_FAIL, _("mount: cannot set group id: %m"));
if (setuid(getuid()) < 0)
- die(EX_FAIL, _("mount: cannot set user id: %s"), strerror(errno));
+ die(EX_FAIL, _("mount: cannot set user id: %m"));
oo = fix_opts_string (flags, extra_opts, NULL);
mountargs[i++] = mountprog; /* 1 */
@@ -1470,8 +1470,7 @@ cdrom_setspeed(const char *spec) {
_("mount: cannot open %s for setting speed"),
spec);
if (ioctl(cdrom, CDROM_SELECT_SPEED, speed) < 0)
- die(EX_FAIL, _("mount: cannot set speed: %s"),
- strerror(errno));
+ die(EX_FAIL, _("mount: cannot set speed: %m"));
close(cdrom);
}
}
diff --git a/mount/umount.c b/mount/umount.c
index 5000aa569..c7ebf7d3c 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -129,10 +129,10 @@ check_special_umountprog(const char *node,
int i = 0;
if(setgid(getgid()) < 0)
- die(EX_FAIL, _("umount: cannot set group id: %s"), strerror(errno));
+ die(EX_FAIL, _("umount: cannot set group id: %m"));
if(setuid(getuid()) < 0)
- die(EX_FAIL, _("umount: cannot set user id: %s"), strerror(errno));
+ die(EX_FAIL, _("umount: cannot set user id: %m"));
umountargs[i++] = umountprog;
umountargs[i++] = xstrdup(node);
@@ -244,12 +244,10 @@ static const char *chdir_to_parent(const char *node, char **resbuf)
}
if (chdir(parent) == -1)
- die (2, _("umount: failed to chdir to %s: %s"),
- parent, strerror(errno));
+ die (2, _("umount: failed to chdir to %s: %m"), parent);
if (!getcwd(buf, sizeof(buf)))
- die (2, _("umount: failed to obtain current directory: %s"),
- strerror(errno));
+ die (2, _("umount: failed to obtain current directory: %m"));
if (strcmp(buf, parent) != 0)
die (2, _("umount: mountpoint moved (%s -> %s)"), parent, buf);
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c
index 2cf015fb4..475c1cec6 100644
--- a/sys-utils/chcpu.c
+++ b/sys-utils/chcpu.c
@@ -96,8 +96,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
printf(_("CPU %d enable failed "
"(CPU is deconfigured)\n"), cpu);
else if (rc == -1)
- printf(_("CPU %d enable failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d enable failed (%m)\n"), cpu);
else
printf(_("CPU %d enabled\n"), cpu);
} else {
@@ -108,8 +107,7 @@ static int cpu_enable(cpu_set_t *cpu_set, size_t setsize, int enable)
}
rc = path_writestr("0", _PATH_SYS_CPU "/cpu%d/online", cpu);
if (rc == -1)
- printf(_("CPU %d disable failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d disable failed (%m)\n"), cpu);
else {
printf(_("CPU %d disabled\n"), cpu);
if (onlinecpus)
@@ -181,15 +179,13 @@ static int cpu_configure(cpu_set_t *cpu_set, size_t setsize, int configure)
if (configure) {
rc = path_writestr("1", _PATH_SYS_CPU "/cpu%d/configure", cpu);
if (rc == -1)
- printf(_("CPU %d configure failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d configure failed (%m)\n"), cpu);
else
printf(_("CPU %d configured\n"), cpu);
} else {
rc = path_writestr("0", _PATH_SYS_CPU "/cpu%d/configure", cpu);
if (rc == -1)
- printf(_("CPU %d deconfigure failed (%s)\n"), cpu,
- strerror(errno));
+ printf(_("CPU %d deconfigure failed (%m)\n"), cpu);
else
printf(_("CPU %d deconfigured\n"), cpu);
}
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 0e124bc71..49f0cbd6c 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -211,8 +211,8 @@ main(int argc, char **argv) {
exit(1);
}
if (write(fd, &multiplier, to_write) != to_write) {
- fprintf(stderr, _("readprofile: error writing %s: %s\n"),
- defaultpro, strerror(errno));
+ fprintf(stderr, _("readprofile: error writing %s: %m\n"),
+ defaultpro);
exit(1);
}
close(fd);
@@ -225,7 +225,7 @@ main(int argc, char **argv) {
if (((proFd=open(proFile,O_RDONLY)) < 0)
|| ((int)(len=lseek(proFd,0,SEEK_END)) < 0)
|| (lseek(proFd,0,SEEK_SET) < 0)) {
- fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
+ fprintf(stderr,"%s: %s: %m\n", prgname, proFile);
exit(1);
}
@@ -233,7 +233,7 @@ main(int argc, char **argv) {
rc = read(proFd,buf,len);
if (rc < 0 || (size_t) rc != len) {
- fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));
+ fprintf(stderr,"%s: %s: %m\n", prgname, proFile);
exit(1);
}
close(proFd);
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index b5c197327..5253f7a5c 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -97,7 +97,7 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
return (NULL);
if (strlen(strerror(errno)) > 1000)
return (NULL);
- (void) sprintf(errbuf, "%s: %s", device, strerror(errno));
+ (void) sprintf(errbuf, "%s: %m", device);
errbuf[1024] = 0;
return (errbuf);
}