[sheepdog] [PATCH v2 5/5] sheep: use %m instead of strerror(errno)
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Feb 25 16:11:14 CET 2013
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/plain_store.c | 4 ++--
sheep/sheep.c | 3 +--
sheep/store.c | 8 +++-----
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 69dd133..3ef22eb 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -519,12 +519,12 @@ int default_flush(void)
fd = open(obj_path, O_RDONLY);
if (fd < 0) {
- sd_eprintf("error at open() %s, %s", obj_path, strerror(errno));
+ sd_eprintf("error at open() %s, %m", obj_path);
return SD_RES_NO_OBJ;
}
if (syncfs(fd)) {
- sd_eprintf("error at syncfs(), %s", strerror(errno));
+ sd_eprintf("error at syncfs(), %m");
ret = SD_RES_EIO;
}
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 19fa3ee..1572149 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -705,8 +705,7 @@ int main(int argc, char **argv)
exit(1);
if (pid_file && (create_pidfile(pid_file) != 0)) {
- fprintf(stderr, "failed to pid file '%s' - %s\n", pid_file,
- strerror(errno));
+ fprintf(stderr, "failed to pid file '%s' - %m\n", pid_file);
exit(1);
}
diff --git a/sheep/store.c b/sheep/store.c
index 01fd979..7f3b5cd 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -71,7 +71,7 @@ int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes)
err:
close(fd);
err_open:
- sd_dprintf("%s", strerror(errno));
+ sd_dprintf("%m");
return -1;
}
@@ -212,8 +212,7 @@ static int lock_base_dir(const char *d)
fd = open(lock_path, O_WRONLY|O_CREAT, def_fmode);
if (fd < 0) {
- sd_eprintf("failed to open lock file %s (%s)", lock_path,
- strerror(errno));
+ sd_eprintf("failed to open lock file %s (%m)", lock_path);
ret = -1;
goto out;
}
@@ -222,8 +221,7 @@ static int lock_base_dir(const char *d)
if (errno == EACCES || errno == EAGAIN) {
sd_eprintf("another sheep daemon is using %s", d);
} else {
- sd_eprintf("unable to get base dir lock (%s)",
- strerror(errno));
+ sd_eprintf("unable to get base dir lock (%m)");
}
ret = -1;
goto out;
--
1.8.1.3.566.gaa39828
More information about the sheepdog
mailing list