diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-18 08:44:02 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-09-18 08:44:02 +0200 |
commit | 210e7f92454e2b99a448c1563e22fed6f0220ea7 (patch) | |
tree | 6c4750cc36b44646bfe05d38cfd53f3af62ac40d /src/modules | |
parent | ac00100cb800423347ad81967a7731ab766be629 (diff) | |
download | px4-firmware-210e7f92454e2b99a448c1563e22fed6f0220ea7.tar.gz px4-firmware-210e7f92454e2b99a448c1563e22fed6f0220ea7.tar.bz2 px4-firmware-210e7f92454e2b99a448c1563e22fed6f0220ea7.zip |
Make param save command tolerant of FS timing
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/systemlib/param/param.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index c69de52b7..e7c96fe54 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -519,6 +519,10 @@ param_save_default(void) int fd = open(param_get_default_file(), O_WRONLY | O_CREAT | O_EXCL); if (fd < 0) { + /* do another attempt in case the unlink call is not synced yet */ + usleep(5000); + fd = open(param_get_default_file(), O_WRONLY | O_CREAT | O_EXCL); + warn("opening '%s' for writing failed", param_get_default_file()); return fd; } @@ -528,7 +532,7 @@ param_save_default(void) if (result != 0) { warn("error exporting parameters to '%s'", param_get_default_file()); - unlink(param_get_default_file()); + (void)unlink(param_get_default_file()); return result; } |