aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-07-07 22:31:19 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-07-07 22:31:54 +0200
commita23c2e3dd2bba016a63213ebc64378b40a2f5967 (patch)
tree01dbb991f13d242d0a5a7fd3b3e2d2ad9a9cd95b /src/modules
parent3b06a74074f71c0700c6e7e9b56954213142aaeb (diff)
parent20e871439be1cada5a7c810f887a2495e7ff6308 (diff)
downloadpx4-firmware-a23c2e3dd2bba016a63213ebc64378b40a2f5967.tar.gz
px4-firmware-a23c2e3dd2bba016a63213ebc64378b40a2f5967.tar.bz2
px4-firmware-a23c2e3dd2bba016a63213ebc64378b40a2f5967.zip
Merged master into offboard2_merge
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/mavlink/mavlink_ftp.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp
index 55a472bf6..57ae6076c 100644
--- a/src/modules/mavlink/mavlink_ftp.cpp
+++ b/src/modules/mavlink/mavlink_ftp.cpp
@@ -199,12 +199,18 @@ MavlinkFTP::ErrorCode
MavlinkFTP::_workList(Request *req)
{
auto hdr = req->header();
- DIR *dp = opendir(req->dataAsCString());
+
+ char dirPath[kMaxDataLength];
+ strncpy(dirPath, req->dataAsCString(), kMaxDataLength);
+
+ DIR *dp = opendir(dirPath);
if (dp == nullptr) {
- printf("FTP: can't open path '%s'\n", req->dataAsCString());
+ printf("FTP: can't open path '%s'\n", dirPath);
return kErrNotDir;
}
+
+ printf("FTP: list %s offset %d\n", dirPath, hdr->offset);
ErrorCode errorCode = kErrNone;
struct dirent entry, *result = nullptr;
@@ -216,6 +222,7 @@ MavlinkFTP::_workList(Request *req)
for (;;) {
// read the directory entry
if (readdir_r(dp, &entry, &result)) {
+ printf("FTP: list %s readdir_r failure\n", dirPath);
errorCode = kErrIO;
break;
}
@@ -251,8 +258,8 @@ MavlinkFTP::_workList(Request *req)
// copy the name, which we know will fit
strcpy((char *)&hdr->data[offset], entry.d_name);
+ //printf("FTP: list %s %s\n", dirPath, (char *)&hdr->data[offset-1]);
offset += strlen(entry.d_name) + 1;
- printf("FTP: list %s\n", entry.d_name);
}
closedir(dp);