GNOME Bugzilla – Bug 639771
g_dir_read_name() can also return NULL on error
Last modified: 2012-07-06 02:25:59 UTC
g_dir_read_name() returns the entry's name or NULL if there are no more entries. On POSIX systems, g_dir_read_name() is based on readdir() that can also return NULL if an error occurs. Checking errno allows normally to distinct between the two cases. See example at http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir.html The documentation should maybe be updated to inform the user to check errno when g_dir_read_name() returns NULL.
The following fix has been pushed: ab4cc22 Improve the g_dir_read_name documentation
Created attachment 218144 [details] [review] Improve the g_dir_read_name documentation This function can return NULL in error cases as well. Document this, and explain how to discriminate the cases.