From e9d26b3a32965b6150b17744dbec021d7c66105a Mon Sep 17 00:00:00 2001 From: jlemon Date: Thu, 21 Aug 1997 22:33:59 +0000 Subject: Enable simultaneous use of -u and -p options. Release any resources before calling post-processing script. PR: 2864 Submitted by: Mike Spengler --- sbin/modload/modload.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sbin/modload') diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index d85f3b1..a6ec09d 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: modload.c,v 1.18 1997/03/29 03:32:29 imp Exp $ + * $Id: modload.c,v 1.19 1997/06/29 20:38:38 bde Exp $ */ #include @@ -150,6 +150,8 @@ cleanup() if (fileopen & MOD_OPEN) close(modfd); + + fileopen = 0; } int @@ -375,6 +377,9 @@ main(argc, argv) fileopen &= ~PART_RESRV; /* loaded */ if(!quiet) printf("Module loaded as ID %d\n", resrv.slot); + if (dounlink && unlink(out)) + err(17, "unlink(%s)", out); + if (post) { struct lmc_stat sbuf; char id[16], type[16], offset[16]; @@ -387,15 +392,13 @@ main(argc, argv) sprintf(offset, "%d", sbuf.offset); /* XXX the modload docs say that drivers can install bdevsw & cdevsw, but the interface only supports one at a time. sigh. */ + + /* Free resources before calling post-install program */ + cleanup(); + execl(post, post, id, type, offset, 0); err(16, "can't exec '%s'", post); } - if(dounlink) { - if(unlink(out)) { - err(17, "unlink(%s)", out); - } - } - return 0; } -- cgit v1.1