Pārlūkot izejas kodu

fix vfs_lseek() result checking in enduser_setup and clarify SPIFFS_lseek() return value (#1570)

Arnim Läuger 7 gadi atpakaļ
vecāks
revīzija
fdc766be9f
2 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 1 1
      app/modules/enduser_setup.c
  2. 2 1
      app/spiffs/spiffs.c

+ 1 - 1
app/modules/enduser_setup.c

@@ -424,7 +424,7 @@ static int enduser_setup_http_load_payload(void)
   c_sprintf(cl_hdr, http_header_content_len_fmt, file_len);
   size_t cl_len = c_strlen(cl_hdr);
 
-  if (!f || err != VFS_RES_OK || err2 != VFS_RES_OK)
+  if (!f || err == VFS_RES_ERR || err2 == VFS_RES_ERR)
   {
     ENDUSER_SETUP_DEBUG("enduser_setup_http_load_payload unable to load file enduser_setup.html, loading backup HTML.");
 

+ 2 - 1
app/spiffs/spiffs.c

@@ -459,7 +459,8 @@ static sint32_t myspiffs_vfs_lseek( const struct vfs_file *fd, sint32_t off, int
     break;
   }
 
-  return SPIFFS_lseek( &fs, fh, off, spiffs_whence );
+  sint32_t res = SPIFFS_lseek( &fs, fh, off, spiffs_whence );
+  return res >= 0 ? res : VFS_RES_ERR;
 }
 
 static sint32_t myspiffs_vfs_eof( const struct vfs_file *fd ) {