diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-08-03 09:30:13 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-08-03 09:30:13 +0000 |
commit | 91b6465b5570df40406b4fb89658deccffa77fd5 (patch) | |
tree | 3945ca360d36a88eceee239236369fa5cee0a64b /sbin/disklabel/editor.c | |
parent | 7e9cc110087e22ebadf6dce525e748896bf117b4 (diff) |
Handle geometry parameters as unsigned quantities, getting rid of
negative number of sectors on large disks and other similar problems.
Also make reading of ASCII disk labels more robust by using strtonum(3)
instead of atoi(3).
ok millert@ deraadt@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r-- | sbin/disklabel/editor.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index b276cb30034..3daa3dc2895 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.93 2003/12/29 19:51:34 millert Exp $ */ +/* $OpenBSD: editor.c,v 1.94 2004/08/03 09:30:12 otto Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -17,7 +17,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: editor.c,v 1.93 2003/12/29 19:51:34 millert Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.94 2004/08/03 09:30:12 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -809,15 +809,15 @@ editor_display(struct disklabel *lp, char **mp, u_int32_t *freep, char unit) printf("type: %s\n", dktypenames[lp->d_type]); printf("disk: %.*s\n", (int)sizeof(lp->d_typename), lp->d_typename); printf("label: %.*s\n", (int)sizeof(lp->d_packname), lp->d_packname); - printf("bytes/sector: %ld\n", (long)lp->d_secsize); - printf("sectors/track: %ld\n", (long)lp->d_nsectors); - printf("tracks/cylinder: %ld\n", (long)lp->d_ntracks); - printf("sectors/cylinder: %ld\n", (long)lp->d_secpercyl); - printf("cylinders: %ld\n", (long)lp->d_ncylinders); - printf("total sectors: %ld\n", (long)lp->d_secperunit); + printf("bytes/sector: %u\n", lp->d_secsize); + printf("sectors/track: %u\n", lp->d_nsectors); + printf("tracks/cylinder: %u\n", lp->d_ntracks); + printf("sectors/cylinder: %u\n", lp->d_secpercyl); + printf("cylinders: %u\n", lp->d_ncylinders); + printf("total sectors: %u\n", lp->d_secperunit); printf("free sectors: %u\n", *freep); - printf("rpm: %ld\n", (long)lp->d_rpm); - printf("\n%d partitions:\n", lp->d_npartitions); + printf("rpm: %hu\n", lp->d_rpm); + printf("\n%hu partitions:\n", lp->d_npartitions); width = width_partition(lp, unit); printf("# %*.*s %*.*s fstype [fsize bsize cpg]\n", width, width, "size", width, width, "offset"); |