diff options
-rw-r--r-- | bin/chmod/chmod.c | 6 | ||||
-rw-r--r-- | bin/cp/cp.c | 10 | ||||
-rw-r--r-- | bin/dd/args.c | 6 | ||||
-rw-r--r-- | bin/mv/mv.c | 8 | ||||
-rw-r--r-- | bin/rm/rm.c | 4 | ||||
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 5 | ||||
-rw-r--r-- | sbin/newfs_ext2fs/newfs_ext2fs.c | 4 |
7 files changed, 20 insertions, 23 deletions
diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c index 64a9daf8baf..203d2a36449 100644 --- a/bin/chmod/chmod.c +++ b/bin/chmod/chmod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chmod.c,v 1.29 2014/03/16 18:38:30 guenther Exp $ */ +/* $OpenBSD: chmod.c,v 1.30 2014/05/21 06:23:01 guenther Exp $ */ /* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */ /* @@ -212,7 +212,7 @@ done: else continue; case FTS_DNR: /* Warn, chmod, continue. */ - warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); + warnc(p->fts_errno, "%s", p->fts_path); rval = 1; break; case FTS_DP: /* Already changed at FTS_D. */ @@ -222,7 +222,7 @@ done: break; case FTS_ERR: /* Warn, continue. */ case FTS_NS: - warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); + warnc(p->fts_errno, "%s", p->fts_path); rval = 1; continue; case FTS_SL: /* Ignore. */ diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 27ad524d435..436e4eb6712 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.35 2012/08/28 06:02:58 otto Exp $ */ +/* $OpenBSD: cp.c,v 1.36 2014/05/21 06:23:02 guenther Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -409,10 +409,8 @@ copy(char *argv[], enum op type, int fts_options) if (mkdir(to.p_path, curr->fts_statp->st_mode | S_IRWXU) < 0) err(1, "%s", to.p_path); - } else if (!S_ISDIR(to_stat.st_mode)) { - errno = ENOTDIR; - err(1, "%s", to.p_path); - } + } else if (!S_ISDIR(to_stat.st_mode)) + errc(1, ENOTDIR, "%s", to.p_path); break; case S_IFBLK: case S_IFCHR: @@ -432,7 +430,7 @@ copy(char *argv[], enum op type, int fts_options) rval = 1; break; case S_IFSOCK: - warnx("%s: %s", curr->fts_path, strerror(EOPNOTSUPP)); + warnc(EOPNOTSUPP, "%s", curr->fts_path); break; default: if (copy_file(curr, fts_dne(curr))) diff --git a/bin/dd/args.c b/bin/dd/args.c index 827337a9e02..fb0f0178338 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -1,4 +1,4 @@ -/* $OpenBSD: args.c,v 1.24 2014/03/27 15:32:13 tedu Exp $ */ +/* $OpenBSD: args.c,v 1.25 2014/05/21 06:23:02 guenther Exp $ */ /* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */ /*- @@ -383,7 +383,7 @@ get_bsz(char *val) } return (num); erange: - errx(1, "%s: %s", oper, strerror(ERANGE)); + errc(1, ERANGE, "%s", oper); } /* @@ -462,5 +462,5 @@ get_off(char *val) } return (num); erange: - errx(1, "%s: %s", oper, strerror(ERANGE)); + errc(1, ERANGE, "%s", oper); } diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 979797ddff0..23c49fb5f90 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mv.c,v 1.35 2009/10/27 23:59:22 deraadt Exp $ */ +/* $OpenBSD: mv.c,v 1.36 2014/05/21 06:23:02 guenther Exp $ */ /* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */ /* @@ -300,13 +300,13 @@ err: if (unlink(to)) (void)close(from_fd); if (badchown) { - errno = serrno; if ((sbp->st_mode & (S_ISUID|S_ISGID))) { - warn("%s: set owner/group; not setting setuid/setgid", + warnc(serrno, + "%s: set owner/group; not setting setuid/setgid", to); sbp->st_mode &= ~(S_ISUID|S_ISGID); } else if (!fflg) - warn("%s: set owner/group", to); + warnc(serrno, "%s: set owner/group", to); } if (fchmod(to_fd, sbp->st_mode)) warn("%s: set mode", to); diff --git a/bin/rm/rm.c b/bin/rm/rm.c index bc08516c8f5..ed43f02e5b8 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.28 2013/04/23 18:41:08 deraadt Exp $ */ +/* $OpenBSD: rm.c,v 1.29 2014/05/21 06:23:02 guenther Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -152,7 +152,7 @@ rm_tree(char **argv) } continue; case FTS_ERR: - errx(1, "%s: %s", p->fts_path, strerror(p->fts_errno)); + errc(1, p->fts_errno, "%s", p->fts_path); case FTS_NS: /* * FTS_NS: assume that if can't stat the file, it diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 33c0c692373..74a10d6359d 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_nfs.c,v 1.50 2012/05/29 20:04:59 jasper Exp $ */ +/* $OpenBSD: mount_nfs.c,v 1.51 2014/05/21 06:23:01 guenther Exp $ */ /* $NetBSD: mount_nfs.c,v 1.12.4.1 1996/05/25 22:48:05 fvdl Exp $ */ /* @@ -505,8 +505,7 @@ tryagain: if (nfhret.stat) { if (opflags & ISBGRND) exit(1); - errno = nfhret.stat; - warnx("can't access %s: %s", spec, strerror(nfhret.stat)); + warnc(nfhret.stat, "can't access %s", spec); return (0); } saddr.sin_port = htons(tport); diff --git a/sbin/newfs_ext2fs/newfs_ext2fs.c b/sbin/newfs_ext2fs/newfs_ext2fs.c index ba3e8e307f1..55e2eb5945e 100644 --- a/sbin/newfs_ext2fs/newfs_ext2fs.c +++ b/sbin/newfs_ext2fs/newfs_ext2fs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs_ext2fs.c,v 1.11 2014/04/22 00:23:35 guenther Exp $ */ +/* $OpenBSD: newfs_ext2fs.c,v 1.12 2014/05/21 06:23:01 guenther Exp $ */ /* $NetBSD: newfs_ext2fs.c,v 1.8 2009/03/02 10:38:13 tsutsui Exp $ */ /* @@ -511,7 +511,7 @@ getpartition(int fsi, const char *special, char *argv[], struct disklabel **dl) struct partition *pp; if (fstat(fsi, &st) < 0) - errx(EXIT_FAILURE, "%s: %s", special, strerror(errno)); + err(EXIT_FAILURE, "%s", special); if (S_ISBLK(st.st_mode)) errx(EXIT_FAILURE, "%s: block device", special); if (!S_ISCHR(st.st_mode)) |