From 22d46e4f22fdcbb87706a4b03e8f6b04c55f763a Mon Sep 17 00:00:00 2001 From: gadget-man Date: Fri, 27 Mar 2026 21:40:48 +0000 Subject: [PATCH] Fix bug in logging for VFS start_select function Resolves issue identified in https://github.com/espressif/esp-idf/issues/18398 by seperating logging when `vfs == NULL` Closes https://github.com/espressif/esp-idf/pull/18400 Closes https://github.com/espressif/esp-idf/issues/18398 --- components/vfs/vfs_calls.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/vfs/vfs_calls.c b/components/vfs/vfs_calls.c index 85c5b25aaf5..a8c4695426a 100644 --- a/components/vfs/vfs_calls.c +++ b/components/vfs/vfs_calls.c @@ -656,8 +656,13 @@ int esp_vfs_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds const vfs_entry_t *vfs = get_vfs_for_index(i); fds_triple_t *item = &vfs_fds_triple[i]; - if (vfs == NULL || vfs->vfs->select == NULL || vfs->vfs->select->start_select == NULL) { - ESP_LOGD(TAG, "start_select function callback for this vfs (s_vfs[%d]) is not defined", vfs->offset); + if (vfs == NULL) { + ESP_LOGD(TAG, "start_select callback not defined: vfs is NULL at index %u", (unsigned)i); + continue; + } + + if (vfs->vfs == NULL || vfs->vfs->select == NULL || vfs->vfs->select->start_select == NULL) { + ESP_LOGD(TAG, "start_select callback not defined for VFS offset %d", vfs->offset); continue; }