From: kn Date: Tue, 27 Sep 2022 11:42:16 +0000 (+0000) Subject: fix passing explicit stage files X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b8f3f2d0784c35fb04c9129a17c0b61ab864d060;p=openbsd fix passing explicit stage files This fixes installboot regress on octeon; same diff as macppc_installboot.c r1.6 and powerpc64_installboot r1.7. --- diff --git a/usr.sbin/installboot/octeon_installboot.c b/usr.sbin/installboot/octeon_installboot.c index 40fc87d4c29..75d8bf969b6 100644 --- a/usr.sbin/installboot/octeon_installboot.c +++ b/usr.sbin/installboot/octeon_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octeon_installboot.c,v 1.7 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: octeon_installboot.c,v 1.8 2022/09/27 11:42:16 kn Exp $ */ /* * Copyright (c) 2011 Joel Sing @@ -60,6 +60,8 @@ static int findmbrfat(int, struct disklabel *); void md_init(void) { + stages = 1; + stage1 = "/usr/mdec/boot"; } void @@ -161,12 +163,9 @@ write_filesystem(struct disklabel *dl, char part) struct msdosfs_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) @@ -224,17 +223,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; } @@ -252,8 +245,6 @@ rmdir: if (rmdir(dst) == -1) err(1, "rmdir('%s') failed", dst); - free(src); - if (rslt == -1) exit(1); }