Skip to content
Snippets Groups Projects
Commit 95d0b9a2 authored by schneider's avatar schneider
Browse files

recovery: fix some compiler warnings

parent 329dbc32
No related branches found
No related tags found
No related merge requests found
...@@ -175,8 +175,15 @@ static void _scan_dir(char *dir, char *dir_name) { ...@@ -175,8 +175,15 @@ static void _scan_dir(char *dir, char *dir_name) {
esp32_standard_header_t hdr; esp32_standard_header_t hdr;
char path[64]; char path[64];
snprintf(path, sizeof(path) / sizeof(char), "%s/%s", dir, int ret = snprintf(path, sizeof(path) / sizeof(char), "%s/%s",
pDirent->d_name); dir, pDirent->d_name);
// Error or too long
if (ret < 0 || ret > sizeof(path) / sizeof(char)) {
ESP_LOGW(TAG, "could not build file path");
continue;
}
FILE *f = fopen(path, "rb"); FILE *f = fopen(path, "rb");
if (f == NULL) { if (f == NULL) {
ESP_LOGW(TAG, "fopen failed: %s", strerror(errno)); ESP_LOGW(TAG, "fopen failed: %s", strerror(errno));
...@@ -197,8 +204,12 @@ static void _scan_dir(char *dir, char *dir_name) { ...@@ -197,8 +204,12 @@ static void _scan_dir(char *dir, char *dir_name) {
} }
image_entry_t *ie = &image_list[entry]; image_entry_t *ie = &image_list[entry];
snprintf(ie->label, sizeof(ie->label), "%s/%s: %s", dir_name, ret = snprintf(ie->label, sizeof(ie->label), "%s/%s: %s",
pDirent->d_name, hdr.app.project_name); dir_name, pDirent->d_name, hdr.app.project_name);
if (ret < 0) {
ESP_LOGW(TAG, "could not build menu entry");
continue;
}
snprintf(ie->path, sizeof(ie->path), "%s", path); snprintf(ie->path, sizeof(ie->path), "%s", path);
_list_menu_entries[entry].label = ie->label; _list_menu_entries[entry].label = ie->label;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment