[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Truncated filenames in struct directs returned from dir_readdir

From: Andrew Eggenberger
Subject: Truncated filenames in struct directs returned from dir_readdir
Date: Sun, 18 Apr 2021 20:16:07 -0500

As part of a translator I'm working on, I'm calling dir_readdir from fs.h on the 
underlying file of the translator. This works except that the `struct direct`s returned 
in the data_t arg only contain the first four bytes of the `direct.d_name` field. The
`d_namlen` field is correct. A google search didn't turn up anything about this in 
the Hurd or glibc, but I found this page[1] that says a dirent (which is what direct
is aliased to in glibc) only contains space for the first four bits. Space for the name
has to be allocated in addition to the space needed for struct dirent. Is that what's 
happening in my case? And if so, is there a way to provide that space to my call
to dir_readdir so it provides full file names? From what I can tell it allocates its 
own storage for the data_t pointer it writes to.

[1]: http://www.qnx.com/developers/docs/6.5.0SP1.update/com.qnx.doc.neutrino_lib_ref//d/dirent.html

Andrew Eggenberger

reply via email to

[Prev in Thread] Current Thread [Next in Thread]