summaryrefslogtreecommitdiffstats
path: root/usr.sbin/installboot/util.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2015-10-14 00:19:04 +0000
committerkrw <krw@openbsd.org>2015-10-14 00:19:04 +0000
commite09cbf079135fc8dbf825dd3f53fbfa0ab80dde2 (patch)
treec9b774bf263ee2431832c752286243be3bae4bf4 /usr.sbin/installboot/util.c
parentReject the escape sequences \[uD800] to \[uDFFF] in the parser. (diff)
downloadwireguard-openbsd-e09cbf079135fc8dbf825dd3f53fbfa0ab80dde2.tar.xz
wireguard-openbsd-e09cbf079135fc8dbf825dd3f53fbfa0ab80dde2.zip
Backout last. Breaks sparc64, amoung other dubiousness.
requested by deraadt@
Diffstat (limited to 'usr.sbin/installboot/util.c')
-rw-r--r--usr.sbin/installboot/util.c19
1 files changed, 4 insertions, 15 deletions
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);