nih_file_read() cannot read files in procfs - eg /proc/cmdline which is populated on a read()

Bug #802487 reported by Surbhi Palande on 2011-06-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

nih_file_read () uses stat to find out the length of a file and then uses this length to read the contents of a file. For a file like /proc/cmdline which gets populated on a read (), stat returns 0 for the length of the file. Thus nih_file_read () issues a read () for len=0 bytes and returns an empty string.
There does not seem much of a solution for this problem. However what we could do is if the user specifies a length to be read, then nih_file_read () should call read () with that length rather than what stat specifies. This way the function could become capable of reading either the whole file (user requests len = 0) or a requested length of file.
Please do provide this functionality. Thanks!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers