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>
This commit is contained in:
Jonathan Lemon 1997-08-21 22:33:59 +00:00
parent d623c5c11e
commit e816bc9767
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28556

View File

@ -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;
}