diff options
| author | 2015-01-16 06:39:28 +0000 | |
|---|---|---|
| committer | 2015-01-16 06:39:28 +0000 | |
| commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
| tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /sbin/disklabel/editor.c | |
| parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
| download | wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip | |
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'sbin/disklabel/editor.c')
| -rw-r--r-- | sbin/disklabel/editor.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index f323e623db5..ef8c3475e65 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.288 2014/10/11 03:08:26 doug Exp $ */ +/* $OpenBSD: editor.c,v 1.289 2015/01/16 06:39:57 deraadt Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -16,8 +16,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <sys/param.h> /* MAXBSIZE DEV_BSIZE MAXFRAG */ #include <sys/types.h> -#include <sys/param.h> +#include <sys/signal.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/dkio.h> @@ -35,10 +36,13 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <limits.h> #include "extern.h" #include "pathnames.h" +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) + /* flags for getuint64() */ #define DO_CONVERSIONS 0x00000001 #define DO_ROUNDING 0x00000002 @@ -1465,7 +1469,7 @@ edit_parms(struct disklabel *lp) /* total sectors */ for (;;) { - u_int64_t nsec = MAX(DL_GETDSIZE(lp), + u_int64_t nsec = MAXIMUM(DL_GETDSIZE(lp), (u_int64_t)lp->d_ncylinders * lp->d_secpercyl); ui = getuint64(lp, "total sectors", "The total number of sectors on the disk.", @@ -1832,7 +1836,7 @@ void mpsave(struct disklabel *lp) { int i, j; - char bdev[MAXPATHLEN], *p; + char bdev[PATH_MAX], *p; struct mountinfo mi[MAXPARTITIONS]; FILE *fp; u_int8_t fstype; |
