Browse Source

AP_Filesystem: fixed stat call for @SYS files

c415-sdk
Andrew Tridgell 4 years ago
parent
commit
02e9519ab0
  1. 6
      libraries/AP_Filesystem/AP_Filesystem_Sys.cpp

6
libraries/AP_Filesystem/AP_Filesystem_Sys.cpp

@ -226,7 +226,11 @@ int AP_Filesystem_Sys::stat(const char *pathname, struct stat *stbuf) @@ -226,7 +226,11 @@ int AP_Filesystem_Sys::stat(const char *pathname, struct stat *stbuf)
stbuf->st_size = 0; // just a placeholder value
return 0;
}
int8_t pos = file_in_sysfs(&pathname[1]);
const char *pathname_noslash = pathname;
if (pathname[0] == '/') {
pathname_noslash = &pathname[1];
}
int8_t pos = file_in_sysfs(pathname_noslash);
if (pos < 0) {
errno = ENOENT;
return -1;

Loading…
Cancel
Save