diff options
author | Don Gagne <don@thegagnes.com> | 2014-07-06 14:58:27 -0700 |
---|---|---|
committer | Don Gagne <don@thegagnes.com> | 2014-07-06 14:58:27 -0700 |
commit | 91537934c4ef33444cf582f8a309443d77b3e575 (patch) | |
tree | cb1f1a5865167bebf9036344cf72cb0b7128747e /src/modules/mavlink | |
parent | d67089b23f58ac152253f58c5deaebbd57db0362 (diff) | |
download | px4-firmware-91537934c4ef33444cf582f8a309443d77b3e575.tar.gz px4-firmware-91537934c4ef33444cf582f8a309443d77b3e575.tar.bz2 px4-firmware-91537934c4ef33444cf582f8a309443d77b3e575.zip |
Better logging
Diffstat (limited to 'src/modules/mavlink')
-rw-r--r-- | src/modules/mavlink/mavlink_ftp.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index ca846a465..b2e6e9d30 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\n", dirPath); 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]); offset += strlen(entry.d_name) + 1; - printf("FTP: list %s\n", entry.d_name); } closedir(dp); |