Skip to content
Snippets Groups Projects
Commit e6f2ba98 authored by Daniel Agar's avatar Daniel Agar Committed by Beat Küng
Browse files

bebop_fix fix sign compare

parent 661b36df
No related branches found
No related tags found
No related merge requests found
......@@ -48,10 +48,9 @@ char pgm_path[] = "/home/root/images/";
void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
{
int written, total, fd;
struct stat sb;
// Check if dump directory exists
struct stat sb = {};
if (!(stat(pgm_path, &sb) == 0 && S_ISDIR(sb.st_mode))) {
PX4_ERR("Dump directory does not exist: %s", pgm_path);
PX4_ERR("No images are written!");
......@@ -63,7 +62,7 @@ void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
snprintf(file_path, sizeof(file_path), "%s%s%08u.pgm", pgm_path, pgm_dumpname, seq);
PX4_INFO("%s", file_path);
fd = open(file_path, O_WRONLY | O_NONBLOCK | O_CREAT, 00666);
int fd = open(file_path, O_WRONLY | O_NONBLOCK | O_CREAT, 00666);
if (fd < 0) {
PX4_ERR("Dump: Unable to open file");
......@@ -72,10 +71,10 @@ void dump_pgm(const void *data, uint32_t size, uint32_t seq, uint32_t timestamp)
// Write pgm header
snprintf(&pgm_header[4], 15, "%014d", (int)timestamp);
written = write(fd, pgm_header, sizeof(pgm_header));
size_t written = write(fd, pgm_header, sizeof(pgm_header));
// Write image data
total = 0;
size_t total = 0;
do {
written = write(fd, data, size);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment