diff options
author | Matt Jacob <mjacob@FreeBSD.org> | 2000-07-17 02:05:45 +0000 |
---|---|---|
committer | Matt Jacob <mjacob@FreeBSD.org> | 2000-07-17 02:05:45 +0000 |
commit | e2dc1289d2107f873977aa941b7433e1106dae08 (patch) | |
tree | a6ae5f2a81de9cc956463c174e8374e5c5a17131 /share/examples/scsi_target | |
parent | 0bee04cc98e3fdc122200075103025aa5aacec8c (diff) |
Clean up after oneself on exit.
Notes
Notes:
svn path=/head/; revision=63290
Diffstat (limited to 'share/examples/scsi_target')
-rw-r--r-- | share/examples/scsi_target/scsi_target.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/share/examples/scsi_target/scsi_target.c b/share/examples/scsi_target/scsi_target.c index 8e97585126c6..ae5a8e4ce315 100644 --- a/share/examples/scsi_target/scsi_target.c +++ b/share/examples/scsi_target/scsi_target.c @@ -149,6 +149,7 @@ main(int argc, char *argv[]) if (ioctl(targfd, TARGIODEBUG, &debug) == -1) { perror("TARGIODEBUG"); + (void) ioctl(targctlfd, TARGCTLIOFREEUNIT, &alloc_unit); exit(EX_SOFTWARE); } @@ -156,6 +157,11 @@ main(int argc, char *argv[]) if (buf == NULL) { fprintf(stderr, "%s: Could not malloc I/O buffer", appname); + if (debug) { + debug = 0; + (void) ioctl(targfd, TARGIODEBUG, &debug); + } + (void) ioctl(targctlfd, TARGCTLIOFREEUNIT, &alloc_unit); exit(EX_OSERR); } @@ -173,6 +179,10 @@ main(int argc, char *argv[]) static void cleanup() { + if (debug) { + debug = 0; + (void) ioctl(targfd, TARGIODEBUG, &debug); + } close(targfd); if (ioctl(targctlfd, TARGCTLIOFREEUNIT, &alloc_unit) == -1) { |