summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJonathan Lemon <jlemon@FreeBSD.org>1997-08-21 22:47:42 +0000
committerJonathan Lemon <jlemon@FreeBSD.org>1997-08-21 22:47:42 +0000
commitf5785ca0ab41f7edab5eeba73dc655f9363f0581 (patch)
tree067d79b8a81eeecb13aba6f88e195e47f247f9f3 /sbin
parent6fdaca7c440a1ff7e5d9174ebde6d1e84832b1ec (diff)
Notes
Diffstat (limited to 'sbin')
-rw-r--r--sbin/modload/modload.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c
index 71dffc3a3d95..ebc7b45a36d7 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.13 1996/08/13 00:50:59 pst Exp $
+ * $Id$
*/
#include <stdio.h>
@@ -151,6 +151,8 @@ cleanup()
if (fileopen & MOD_OPEN)
close(modfd);
+
+ fileopen = 0;
}
int
@@ -376,6 +378,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];
@@ -388,15 +393,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;
}