diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-09-27 11:31:47 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-09-27 11:31:47 +0000 |
commit | 0bca95082eb267c01dd654d90d3e34b8db77638b (patch) | |
tree | 67c4ee94909abf5e0cf0536a5902a2159c510163 /usr.sbin/installboot | |
parent | 1f77c41dce90ec05d90e61a924563dc705ea04b5 (diff) |
fix passing explicit stage files
This fixes installboot regress on powerpc64.
The exact same diff already landed for macppc; efi also has the same fix
for md_init() but without the string handling cleanup that entails.
macppc_installboot.c r1.6 "Fix passing explicit stage files":
Using `stage1' leads to a bit more cleanup since early MI installboot.c
handles `-r', i.e. write_filesystem() no longer has needs to do the
fileprefix() dance itself.
OK gkoehler
Diffstat (limited to 'usr.sbin/installboot')
-rw-r--r-- | usr.sbin/installboot/powerpc64_installboot.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/usr.sbin/installboot/powerpc64_installboot.c b/usr.sbin/installboot/powerpc64_installboot.c index 602e019cafd..a8d07f0fd40 100644 --- a/usr.sbin/installboot/powerpc64_installboot.c +++ b/usr.sbin/installboot/powerpc64_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: powerpc64_installboot.c,v 1.6 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: powerpc64_installboot.c,v 1.7 2022/09/27 11:31:46 kn Exp $ */ /* * Copyright (c) 2011 Joel Sing <jsing@openbsd.org> @@ -62,6 +62,8 @@ char duid[20]; void md_init(void) { + stages = 1; + stage1 = "/usr/mdec/boot"; } void @@ -169,12 +171,9 @@ write_filesystem(struct disklabel *dl, char part) char cmd[60]; char dir[PATH_MAX]; char dst[PATH_MAX]; - char *src; - size_t mntlen, srclen; + size_t mntlen; int rslt; - src = NULL; - /* Create directory for temporary mount point. */ strlcpy(dir, "/tmp/installboot.XXXXXXXXXX", sizeof(dst)); if (mkdtemp(dir) == NULL) @@ -232,17 +231,11 @@ write_filesystem(struct disklabel *dl, char part) warn("unable to build /boot path"); goto umount; } - src = fileprefix(root, "/usr/mdec/boot"); - if (src == NULL) { - rslt = -1; - goto umount; - } - srclen = strlen(src); if (verbose) fprintf(stderr, "%s %s to %s\n", - (nowrite ? "would copy" : "copying"), src, dst); + (nowrite ? "would copy" : "copying"), stage1, dst); if (!nowrite) { - rslt = filecopy(src, dst); + rslt = filecopy(stage1, dst); if (rslt == -1) goto umount; } @@ -286,8 +279,6 @@ rmdir: if (rmdir(dir) == -1) err(1, "rmdir('%s') failed", dir); - free(src); - if (rslt == -1) exit(1); } |