mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 10:23:33 +08:00
lsm303d: close fds before exit
This commit is contained in:
committed by
Lorenz Meier
parent
1bac7e7f8b
commit
038ec194ae
@@ -1770,6 +1770,8 @@ start()
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
close(fd_mag);
|
||||
|
||||
exit(0);
|
||||
fail:
|
||||
@@ -1851,6 +1853,9 @@ test()
|
||||
|
||||
/* XXX add poll-rate tests here too */
|
||||
|
||||
close(fd_accel);
|
||||
close(fd_mag);
|
||||
|
||||
reset();
|
||||
errx(0, "PASS");
|
||||
}
|
||||
@@ -1872,6 +1877,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) {
|
||||
@@ -1882,6 +1889,8 @@ reset()
|
||||
err(1, "mag pollrate reset failed");
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user