diff options
author | jlemon <jlemon@FreeBSD.org> | 1997-08-21 22:33:59 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 1997-08-21 22:33:59 +0000 |
commit | e9d26b3a32965b6150b17744dbec021d7c66105a (patch) | |
tree | 17b2526260365cdb41c1d5f40fa0d40876459359 /sbin/modload | |
parent | 08d1bb10c86176063b838a3624e06dd0035c0292 (diff) | |
download | FreeBSD-src-e9d26b3a32965b6150b17744dbec021d7c66105a.zip FreeBSD-src-e9d26b3a32965b6150b17744dbec021d7c66105a.tar.gz |
Enable simultaneous use of -u and -p options. Release any resources before
calling post-processing script.
PR: 2864
Submitted by: Mike Spengler <mks@msc.edu>
Diffstat (limited to 'sbin/modload')
-rw-r--r-- | sbin/modload/modload.c | 17 |
1 files changed, 10 insertions, 7 deletions
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 <stdio.h> @@ -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; } |