diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-10-14 00:19:06 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-10-14 00:19:06 +0000 |
commit | 83704025f8f4a2a8362fb2a9d1c1c9de9a045259 (patch) | |
tree | 5661bf1d95ab0bb45d28c3fac3bdc55465a97b71 /usr.sbin/installboot | |
parent | 9925e5168895883876a7016b4e1fb1e97961064f (diff) |
Backout last. Breaks sparc64, amoung other dubiousness.
requested by deraadt@
Diffstat (limited to 'usr.sbin/installboot')
-rw-r--r-- | usr.sbin/installboot/installboot.c | 19 | ||||
-rw-r--r-- | usr.sbin/installboot/installboot.h | 4 | ||||
-rw-r--r-- | usr.sbin/installboot/util.c | 19 |
3 files changed, 7 insertions, 35 deletions
diff --git a/usr.sbin/installboot/installboot.c b/usr.sbin/installboot/installboot.c index f414af56aba..50d027355c1 100644 --- a/usr.sbin/installboot/installboot.c +++ b/usr.sbin/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.8 2015/10/12 20:52:20 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.9 2015/10/14 00:19:04 krw Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org> @@ -16,9 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <sys/types.h> -#include <sys/disklabel.h> -#include <sys/stat.h> #include <err.h> #include <fcntl.h> #include <stdio.h> @@ -32,8 +29,6 @@ int nowrite; int stages; int verbose; -int dstblkunit; -int dstblkmajor; char *root = "/"; char *stage1; @@ -53,8 +48,7 @@ usage(void) int main(int argc, char **argv) { - struct stat sb; - char *dev, *realdev, *blkdev; + char *dev, *realdev; int devfd, opt; md_init(); @@ -107,15 +101,6 @@ main(int argc, char **argv) &realdev)) < 0) err(1, "open: %s", realdev); - if (realdev == NULL || strncmp(realdev, "/dev/r", 6)) - errx(1, "realdev"); - if (asprintf(&blkdev, "/dev/%s", realdev+6) == -1) - err(1, "asprintf"); - if (stat(blkdev, &sb) == -1) - err(1, "fstat"); - dstblkunit = DISKUNIT(sb.st_rdev); - dstblkmajor = major(sb.st_rdev); - if (verbose) { fprintf(stderr, "%s bootstrap on %s\n", (nowrite ? "would install" : "installing"), realdev); diff --git a/usr.sbin/installboot/installboot.h b/usr.sbin/installboot/installboot.h index 5c9ad69c326..2e56488558e 100644 --- a/usr.sbin/installboot/installboot.h +++ b/usr.sbin/installboot/installboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.h,v 1.6 2015/10/12 20:52:20 krw Exp $ */ +/* $OpenBSD: installboot.h,v 1.7 2015/10/14 00:19:04 krw Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org> * @@ -18,8 +18,6 @@ extern int nowrite; extern int stages; extern int verbose; -extern int dstblkunit; -extern int dstblkmajor; extern char *root; extern char *stage1; diff --git a/usr.sbin/installboot/util.c b/usr.sbin/installboot/util.c index 38206b83133..3b5843c6310 100644 --- a/usr.sbin/installboot/util.c +++ b/usr.sbin/installboot/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.8 2015/10/12 20:52:20 krw Exp $ */ +/* $OpenBSD: util.c,v 1.9 2015/10/14 00:19:05 krw Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> @@ -16,8 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <sys/types.h> -#include <sys/disklabel.h> #include <sys/stat.h> #include <err.h> #include <errno.h> @@ -38,7 +36,7 @@ int filecopy(const char *srcfile, const char *dstfile) { struct stat sb; - ssize_t srcsz, sz, n; + ssize_t sz, n; int sfd, dfd, rslt = -1; char *buf; @@ -56,22 +54,13 @@ filecopy(const char *srcfile, const char *dstfile) warn("fstat"); return (-1); } - srcsz = sz = sb.st_size; + sz = sb.st_size; dfd = open(dstfile, O_WRONLY|O_CREAT); if (dfd == -1) { warn("open %s", dstfile); return (-1); } - if (fstat(dfd, &sb) == -1) { - warn("fstat"); - return (-1); - } - if (major(sb.st_dev) != dstblkmajor || DISKUNIT(sb.st_dev) != - dstblkunit) { - warnx("cross-device install"); - return (-1); - } if (fchown(dfd, 0, 0) == -1) if (errno != EINVAL) { warn("chown"); @@ -95,7 +84,7 @@ filecopy(const char *srcfile, const char *dstfile) } } - ftruncate(dfd, srcsz); + ftruncate(dfd, sb.st_size); close(dfd); close(sfd); |