diff --git a/bin/chcp.c b/bin/chcp.c index 837cf01..8596a14 100644 --- a/bin/chcp.c +++ b/bin/chcp.c @@ -139,7 +139,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR | NILFS_OPEN_GCLK); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(1); } diff --git a/bin/dumpseg.c b/bin/dumpseg.c index 24a3624..0c138b2 100644 --- a/bin/dumpseg.c +++ b/bin/dumpseg.c @@ -218,7 +218,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RAW); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(1); } diff --git a/bin/lscp.c b/bin/lscp.c index 52447e5..2de81b6 100644 --- a/bin/lscp.c +++ b/bin/lscp.c @@ -401,8 +401,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDONLY); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", - progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(EXIT_FAILURE); } diff --git a/bin/lssu.c b/bin/lssu.c index ebbd926..09ed973 100644 --- a/bin/lssu.c +++ b/bin/lssu.c @@ -382,8 +382,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, open_flags); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", - progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(1); } diff --git a/bin/mkcp.c b/bin/mkcp.c index 57cf0c8..9dd6f0e 100644 --- a/bin/mkcp.c +++ b/bin/mkcp.c @@ -123,7 +123,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR | NILFS_OPEN_GCLK); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(1); } diff --git a/bin/rmcp.c b/bin/rmcp.c index 92d672f..0943fe0 100644 --- a/bin/rmcp.c +++ b/bin/rmcp.c @@ -193,7 +193,8 @@ int main(int argc, char *argv[]) nilfs = nilfs_open(dev, NULL, NILFS_OPEN_RDWR); if (nilfs == NULL) { - fprintf(stderr, "%s: %s: cannot open NILFS\n", progname, dev); + fprintf(stderr, "%s: cannot open NILFS on %s: %m\n", + progname, dev ? : "device"); exit(1); }