mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
DataFlash: correct error detection for asprintf
This commit is contained in:
parent
794f7a969e
commit
58d74230d5
@ -422,7 +422,7 @@ bool DataFlash_File::NeedPrep()
|
||||
char *DataFlash_File::_log_file_name(const uint16_t log_num) const
|
||||
{
|
||||
char *buf = nullptr;
|
||||
if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == 0) {
|
||||
if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
return buf;
|
||||
@ -435,7 +435,7 @@ char *DataFlash_File::_log_file_name(const uint16_t log_num) const
|
||||
char *DataFlash_File::_lastlog_file_name(void) const
|
||||
{
|
||||
char *buf = nullptr;
|
||||
if (asprintf(&buf, "%s/LASTLOG.TXT", _log_directory) == 0) {
|
||||
if (asprintf(&buf, "%s/LASTLOG.TXT", _log_directory) == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
return buf;
|
||||
|
Loading…
Reference in New Issue
Block a user