Fixed passed ot open() for O_CREAT

In nuttx the mode parameter to open is not required but in Linux,
and per the POSIX spec, mode is required if the O_CREAT flag is
passed.

The mode flags are different for NuttX and Linux so a new set of
PX4 defines was added:

PX4_O_MODE_777 - read, write, execute for user, group and other
PX4_O_MODE_666 - read, and write for user, group and other
PX4_O_MODE_600 - read, and write for user

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-06-14 11:26:40 +02:00
committed by Lorenz Meier
parent c6b36073fe
commit 872a26e6da
8 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -505,7 +505,7 @@ int open_log_file()
}
}
int fd = open(log_file_path, O_CREAT | O_WRONLY | O_DSYNC, 0x0777);
int fd = open(log_file_path, O_CREAT | O_WRONLY | O_DSYNC, PX4_O_MODE_666);
if (fd < 0) {
mavlink_and_console_log_critical(mavlink_fd, "[sdlog2] failed opening: %s", log_file_name);