mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
lsm303d: close fds before exit
This commit is contained in:
committed by
Lorenz Meier
parent
09ece4306e
commit
acd0a70dca
@@ -1804,6 +1804,8 @@ start()
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
close(fd_mag);
|
||||
|
||||
exit(0);
|
||||
fail:
|
||||
@@ -1885,6 +1887,9 @@ test()
|
||||
|
||||
/* XXX add poll-rate tests here too */
|
||||
|
||||
close(fd_accel);
|
||||
close(fd_mag);
|
||||
|
||||
reset();
|
||||
errx(0, "PASS");
|
||||
}
|
||||
@@ -1906,6 +1911,8 @@ reset()
|
||||
if (ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT) < 0)
|
||||
err(1, "accel pollrate reset failed");
|
||||
|
||||
close(fd);
|
||||
|
||||
fd = open(LSM303D_DEVICE_PATH_MAG, O_RDONLY);
|
||||
|
||||
if (fd < 0) {
|
||||
@@ -1916,6 +1923,8 @@ reset()
|
||||
err(1, "mag pollrate reset failed");
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user