diff options
author | mjacob <mjacob@FreeBSD.org> | 2000-07-17 02:05:45 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2000-07-17 02:05:45 +0000 |
commit | 0789d31aa354ae72b3d760855811623a0bf39b59 (patch) | |
tree | 47baf1fb261a126f4b974580fa4c3f349485c307 /share/examples/scsi_target | |
parent | 978be15898fbb04173cde8c0708ac65184305426 (diff) | |
download | FreeBSD-src-0789d31aa354ae72b3d760855811623a0bf39b59.zip FreeBSD-src-0789d31aa354ae72b3d760855811623a0bf39b59.tar.gz |
Clean up after oneself on exit.
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 8e97585..ae5a8e4 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) { |