summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-02-05 02:17:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-02-05 02:17:33 +0000
commitaa13d2ec5555dbfdc371f1d865cddc5c3de5728e (patch)
tree4ed61809a72e33940f8487544c5fe67f3e30ee0b
parent7406246b8f0f96fc7d5884c1eba639bc65489ed2 (diff)
dev_t is signed to permit passing -1 as an invalid condition, but the
decomposition into major and minor is unsigned, so we should print them with %u instead of %d. ok guenther
-rw-r--r--bin/ls/print.c4
-rw-r--r--bin/ps/print.c4
-rw-r--r--sbin/fsdb/fsdbutil.c6
-rw-r--r--sbin/savecore/savecore.c4
-rw-r--r--usr.bin/file/file.c6
-rw-r--r--usr.bin/find/ls.c4
-rw-r--r--usr.bin/fstat/fstat.c6
-rw-r--r--usr.sbin/config/mkswap.c4
-rw-r--r--usr.sbin/config/sem.c6
-rw-r--r--usr.sbin/procmap/procmap.c10
-rw-r--r--usr.sbin/pstat/pstat.c10
11 files changed, 32 insertions, 32 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 6810e92a169..959282c61a2 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.37 2016/08/16 16:09:24 krw Exp $ */
+/* $OpenBSD: print.c,v 1.38 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */
/*
@@ -109,7 +109,7 @@ printlong(DISPLAY *dp)
if (f_flags)
(void)printf("%-*s ", dp->s_flags, np->flags);
if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
- (void)printf("%3d, %3d ",
+ (void)printf("%3u, %3u ",
major(sp->st_rdev), minor(sp->st_rdev));
else if (dp->bcfile)
(void)printf("%*s%*lld ",
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 14e8ad24de4..b73653f9f41 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.70 2018/06/12 01:58:05 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.71 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
@@ -352,7 +352,7 @@ tdev(const struct kinfo_proc *kp, VARENT *ve)
(void)printf("%*s", v->width, "??");
else {
(void)snprintf(buff, sizeof(buff),
- "%d/%d", major(dev), minor(dev));
+ "%u/%u", major(dev), minor(dev));
(void)printf("%*s", v->width, buff);
}
}
diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c
index 32760e72cc5..cb6e842a747 100644
--- a/sbin/fsdb/fsdbutil.c
+++ b/sbin/fsdb/fsdbutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsdbutil.c,v 1.19 2018/09/16 02:43:11 millert Exp $ */
+/* $OpenBSD: fsdbutil.c,v 1.20 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: fsdbutil.c,v 1.5 1996/09/28 19:30:37 christos Exp $ */
/*-
@@ -96,11 +96,11 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
puts("regular file");
break;
case IFBLK:
- printf("block special (%d,%d)",
+ printf("block special (%u,%u)",
(int)major(DIP(dp, di_rdev)), (int)minor(DIP(dp, di_rdev)));
break;
case IFCHR:
- printf("character special (%d,%d)",
+ printf("character special (%u,%u)",
(int)major(DIP(dp, di_rdev)), (int)minor(DIP(dp, di_rdev)));
break;
case IFLNK:
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index b72a474c2e5..b5db8daddff 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore.c,v 1.60 2018/12/05 05:04:12 yasuoka Exp $ */
+/* $OpenBSD: savecore.c,v 1.61 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
@@ -584,7 +584,7 @@ find_dev(dev_t dev, int type)
}
}
closedir(dfd);
- syslog(LOG_ERR, "can't find device %d/%d", major(dev), minor(dev));
+ syslog(LOG_ERR, "can't find device %u/%u", major(dev), minor(dev));
exit(1);
}
diff --git a/usr.bin/file/file.c b/usr.bin/file/file.c
index 904456443ff..a0eb5a267ba 100644
--- a/usr.bin/file/file.c
+++ b/usr.bin/file/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.67 2019/01/06 18:35:19 tedu Exp $ */
+/* $OpenBSD: file.c,v 1.68 2019/02/05 02:17:32 deraadt Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -539,12 +539,12 @@ try_stat(struct input_file *inf)
xasprintf(&inf->result, "socket");
return (1);
case S_IFBLK:
- xasprintf(&inf->result, "block special (%ld/%ld)",
+ xasprintf(&inf->result, "block special (%lu/%lu)",
(long)major(inf->msg->sb.st_rdev),
(long)minor(inf->msg->sb.st_rdev));
return (1);
case S_IFCHR:
- xasprintf(&inf->result, "character special (%ld/%ld)",
+ xasprintf(&inf->result, "character special (%lu/%lu)",
(long)major(inf->msg->sb.st_rdev),
(long)minor(inf->msg->sb.st_rdev));
return (1);
diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c
index 230c8ea93f4..9ddafe9ceab 100644
--- a/usr.bin/find/ls.c
+++ b/usr.bin/find/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.17 2015/03/15 00:41:28 millert Exp $ */
+/* $OpenBSD: ls.c,v 1.18 2019/02/05 02:17:32 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -66,7 +66,7 @@ printlong(char *name, char *accpath, struct stat *sb)
NAME_WIDTH, UT_NAMESIZE, group_from_gid(sb->st_gid, 0));
if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode))
- (void)printf("%3d, %3d ", major(sb->st_rdev),
+ (void)printf("%3u, %3u ", major(sb->st_rdev),
minor(sb->st_rdev));
else
(void)printf("%8lld ", (long long)sb->st_size);
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 075d396300c..fe89940aa48 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fstat.c,v 1.98 2019/01/28 17:49:50 martijn Exp $ */
+/* $OpenBSD: fstat.c,v 1.99 2019/02/05 02:17:32 deraadt Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <millert@openbsd.org>
@@ -467,7 +467,7 @@ vtrans(struct kinfo_file *kf)
}
if (nflg)
- (void)printf(" %2ld,%-2ld", (long)major(kf->va_fsid),
+ (void)printf(" %2lu,%-2lu", (long)major(kf->va_fsid),
(long)minor(kf->va_fsid));
else if (!(kf->v_flag & VCLONE))
(void)printf(" %-8s", kf->f_mntonname);
@@ -497,7 +497,7 @@ vtrans(struct kinfo_file *kf)
if (nflg || ((name = devname(kf->va_rdev,
kf->v_type == VCHR ? S_IFCHR : S_IFBLK)) == NULL))
- printf(" %2d,%-3d", major(kf->va_rdev), minor(kf->va_rdev));
+ printf(" %2u,%-3u", major(kf->va_rdev), minor(kf->va_rdev));
else
printf(" %7s", name);
if (oflg)
diff --git a/usr.sbin/config/mkswap.c b/usr.sbin/config/mkswap.c
index ddd94d31ba3..645340c5e4f 100644
--- a/usr.sbin/config/mkswap.c
+++ b/usr.sbin/config/mkswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkswap.c,v 1.16 2016/10/16 17:50:00 tb Exp $ */
+/* $OpenBSD: mkswap.c,v 1.17 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */
/*
@@ -76,7 +76,7 @@ mkdevstr(dev_t d)
if (d == NODEV)
(void)snprintf(buf, sizeof buf, "NODEV");
else
- (void)snprintf(buf, sizeof buf, "makedev(%d, %d)",
+ (void)snprintf(buf, sizeof buf, "makedev(%u, %u)",
major(d), minor(d));
return buf;
}
diff --git a/usr.sbin/config/sem.c b/usr.sbin/config/sem.c
index 9fdce78936d..a6c6611e531 100644
--- a/usr.sbin/config/sem.c
+++ b/usr.sbin/config/sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.c,v 1.36 2015/12/14 05:59:56 mmcc Exp $ */
+/* $OpenBSD: sem.c,v 1.37 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.10 1996/11/11 23:40:11 gwr Exp $ */
/*
@@ -550,10 +550,10 @@ resolve(struct nvlist **nvp, const char *name, const char *what,
if (dev->d_major == maj)
break;
if (dev == NULL)
- (void)snprintf(buf, sizeof buf, "<%d/%d>",
+ (void)snprintf(buf, sizeof buf, "<%u/%u>",
maj, min);
else
- (void)snprintf(buf, sizeof buf, "%s%d%c",
+ (void)snprintf(buf, sizeof buf, "%s%u%c",
dev->d_name, min / maxpartitions,
(min % maxpartitions) + 'a');
nv->nv_str = intern(buf);
diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c
index 62d9f24316f..aa6954e918c 100644
--- a/usr.sbin/procmap/procmap.c
+++ b/usr.sbin/procmap/procmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procmap.c,v 1.64 2018/03/31 17:26:13 otto Exp $ */
+/* $OpenBSD: procmap.c,v 1.65 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */
/*
@@ -733,7 +733,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace,
vme->advice);
if (verbose) {
if (inode)
- printf(" %d,%d %llu",
+ printf(" %u,%u %llu",
major(dev), minor(dev),
(unsigned long long)inode);
if (name[0])
@@ -769,7 +769,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace,
vme->protection, vme->max_protection,
vme->inheritance, vme->wired_count, vme->advice);
if (inode && verbose)
- printf("\t(dev=%d,%d ino=%llu [%s] [%p])\n",
+ printf("\t(dev=%u,%u ino=%llu [%s] [%p])\n",
major(dev), minor(dev), (unsigned long long)inode,
inode ? name : "", P(vp));
else if (name[0] == ' ' && verbose)
@@ -805,7 +805,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace,
}
sz = (size_t)((vme->end - vme->start) / 1024);
- printf("%0*lx-%0*lx %7luk %0*lx %c%c%c%c%c (%c%c%c) %d/%d/%d %02d:%02d %7llu - %s",
+ printf("%0*lx-%0*lx %7luk %0*lx %c%c%c%c%c (%c%c%c) %d/%d/%d %02u:%02u %7llu - %s",
(int)sizeof(void *) * 2, vme->start, (int)sizeof(void *) * 2,
vme->end - (vme->start != vme->end ? 1 : 0), (unsigned long)sz,
(int)sizeof(void *) * 2, (unsigned long)vme->offset,
@@ -892,7 +892,7 @@ findname(kvm_t *kd, struct kbit *vmspace,
if (name != NULL)
snprintf(buf, sizeof(buf), "/dev/%s", name);
else
- snprintf(buf, sizeof(buf), " [ device %d,%d ]",
+ snprintf(buf, sizeof(buf), " [ device %u,%u ]",
major(dev), minor(dev));
name = buf;
} else if (UVM_OBJ_IS_AOBJ(D(uvm_obj, uvm_object)))
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index 4bae8c197e9..1684975c57f 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.120 2018/09/10 06:40:06 yasuoka Exp $ */
+/* $OpenBSD: pstat.c,v 1.121 2019/02/05 02:17:32 deraadt Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -566,7 +566,7 @@ ufs_print(struct vnode *vp)
if (S_ISCHR(ip->i_ffs1_mode) || S_ISBLK(ip->i_ffs1_mode))
if (usenumflag ||
((name = devname(ip->i_ffs1_rdev, type)) == NULL))
- (void)printf(" %2d,%-2d",
+ (void)printf(" %2u,%-2u",
major(ip->i_ffs1_rdev), minor(ip->i_ffs1_rdev));
else
(void)printf(" %7s", name);
@@ -666,7 +666,7 @@ nfs_print(struct vnode *vp)
if (S_ISCHR(np->n_vattr.va_mode) || S_ISBLK(np->n_vattr.va_mode))
if (usenumflag ||
((name = devname(np->n_vattr.va_rdev, type)) == NULL))
- (void)printf(" %2d,%-2d", major(np->n_vattr.va_rdev),
+ (void)printf(" %2u,%-2u", major(np->n_vattr.va_rdev),
minor(np->n_vattr.va_rdev));
else
(void)printf(" %7s", name);
@@ -974,7 +974,7 @@ ttyprt(struct itty *tp)
int i, j;
if (usenumflag || (name = devname(tp->t_dev, S_IFCHR)) == NULL)
- (void)printf("%2d,%-3d ", major(tp->t_dev), minor(tp->t_dev));
+ (void)printf("%2u,%-3u ", major(tp->t_dev), minor(tp->t_dev));
else
(void)printf("%7s ", name);
(void)printf("%3d %4d ", tp->t_rawq_c_cc, tp->t_canq_c_cc);
@@ -1146,7 +1146,7 @@ swapmode(void)
if (!totalflag) {
if (usenumflag)
- (void)printf("%2d,%-2d %*d ",
+ (void)printf("%2u,%-2u %*d ",
major(swdev[i].se_dev),
minor(swdev[i].se_dev),
hlen, swdev[i].se_nblks / bdiv);