lx_fs: fix build errors with GCC 12

/data/genode/repos/os/src/server/lx_fs/directory.h: In member function ‘virtual Genode::size_t Lx_fs::Directory::read(char*, Genode::size_t, File_system::seek_off_t)’:
/data/genode/repos/os/src/server/lx_fs/directory.h:224:53: error: ‘dent’ may be used uninitialized [-Werror=maybe-uninitialized]
  224 |                                 .type  = type(dent->d_type),
      |                                               ~~~~~~^~~~~~
/data/genode/repos/os/src/server/lx_fs/directory.h:197:40: note: ‘dent’ was declared here
  197 |                         struct dirent *dent;
      |                                        ^~~~

Issue 
This commit is contained in:
Christian Helmuth 2023-05-10 16:32:30 +02:00
parent d59a2b4b38
commit 37d1855907

View File

@ -193,12 +193,12 @@ class Lx_fs::Directory : public Node
seek_off_t index = seek_offset / sizeof(Directory_entry);
/* seek to index and read entry */
struct dirent *dent;
/* seek to index */
rewinddir(_fd);
for (unsigned i = 0; i <= index; ++i) {
dent = readdir(_fd);
}
for (unsigned i = 0; i < index; ++i)
readdir(_fd);
struct dirent *dent = readdir(_fd);
if (!dent)
return 0;