From dea985b643dc5d5bd59528f674fee37a02a58fc3 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 27 Sep 2022 11:48:57 +0000 Subject: [PATCH] fix passing explicit stage files This fixes installboot regress on octeon; same diff as macppc_installboot.c r1.6, powerpc64_installboot r1.7 and octeon_installboot r1.8. loongson was the last architecture requiring this fix. I don't have a machine to test it myself (loongson isn't built anymore, anyway) but given the same diff works on four other architectures, this should just work. --- usr.sbin/installboot/loongson_installboot.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/usr.sbin/installboot/loongson_installboot.c b/usr.sbin/installboot/loongson_installboot.c index f40ad576190..dd0d47bc92e 100644 --- a/usr.sbin/installboot/loongson_installboot.c +++ b/usr.sbin/installboot/loongson_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loongson_installboot.c,v 1.7 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: loongson_installboot.c,v 1.8 2022/09/27 11:48:57 kn Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -59,6 +59,8 @@ static int findmbrfat(int, struct disklabel *); void md_init(void) { + stages = 1; + stage1 = "/usr/mdec/boot"; } void @@ -103,12 +105,9 @@ write_filesystem(struct disklabel *dl, char part) struct ufs_args args; char cmd[60]; char dst[PATH_MAX]; - char *src; - size_t mntlen, pathlen, srclen; + size_t mntlen, pathlen; int rslt; - src = NULL; - /* Create directory for temporary mount point. */ strlcpy(dst, "/tmp/installboot.XXXXXXXXXX", sizeof(dst)); if (mkdtemp(dst) == NULL) @@ -186,17 +185,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; } @@ -214,8 +207,6 @@ rmdir: if (rmdir(dst) == -1) err(1, "rmdir('%s') failed", dst); - free(src); - if (rslt == -1) exit(1); } -- 2.20.1