diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-01 12:47:10 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-01 12:47:10 +0200 |
commit | 2d83c6f825db02f04624467f3d0b492ee371c72a (patch) | |
tree | 021a5793f2dbff6d6be9b14286a7c3f487d6bcb3 /src/modules/systemlib | |
parent | 9eff3170a3aa63d17fbaefd39619866fb745b237 (diff) | |
download | px4-firmware-2d83c6f825db02f04624467f3d0b492ee371c72a.tar.gz px4-firmware-2d83c6f825db02f04624467f3d0b492ee371c72a.tar.bz2 px4-firmware-2d83c6f825db02f04624467f3d0b492ee371c72a.zip |
Closing all opened file descriptors, fixed param save issue, tests clean
Diffstat (limited to 'src/modules/systemlib')
-rw-r--r-- | src/modules/systemlib/param/param.c | 11 | ||||
-rw-r--r-- | src/modules/systemlib/rc_check.c | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 69a9bdf9b..24b52d1a9 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -505,8 +505,15 @@ param_get_default_file(void) int param_save_default(void) { + int result; + /* delete the file in case it exists */ - unlink(param_get_default_file()); + struct stat buffer; + if (stat(param_get_default_file(), &buffer) == 0) { + result = unlink(param_get_default_file()); + if (result != OK) + warnx("unlinking file %s failed.", param_get_default_file()); + } /* create the file */ int fd = open(param_get_default_file(), O_WRONLY | O_CREAT | O_EXCL); @@ -516,7 +523,7 @@ param_save_default(void) return -1; } - int result = param_export(fd, false); + result = param_export(fd, false); close(fd); if (result != 0) { diff --git a/src/modules/systemlib/rc_check.c b/src/modules/systemlib/rc_check.c index f3a2aee9e..60d6473b8 100644 --- a/src/modules/systemlib/rc_check.c +++ b/src/modules/systemlib/rc_check.c @@ -66,7 +66,7 @@ int rc_calibration_check(void) { // count++; // } - + int channel_fail_count = 0; for (int i = 0; i < RC_CHANNELS_MAX; i++) { /* should the channel be enabled? */ @@ -142,7 +142,12 @@ int rc_calibration_check(void) { /* sanity checks pass, enable channel */ if (count) { mavlink_log_critical(mavlink_fd, "ERROR: %d config error(s) for RC channel %d.", count, (i + 1)); + warnx(mavlink_fd, "ERROR: %d config error(s) for RC channel %d.", count, (i + 1)); usleep(100000); } + + channel_fail_count += count; } + + return channel_fail_count; } |