GNOME Bugzilla – Bug 760324
[PATCH] gkeyfile.c: find_file_in_data_dirs fails to return the path if file descriptor 0 is used
Last modified: 2018-02-02 08:22:00 UTC
Created attachment 318497 [details] [review] Proposed fix to correct file descriptor validity test At the end of find_file_in_data_dirs() in glib/gkeyfile.c: if (output_file != NULL && fd > 0) This check to see whether or not to return the path is faulty, because file descriptor 0 may be 0 validly. The rest of the code uses an inequality with -1 when checking file handles, so this needs to be: if (output_file != NULL && fd != -1) This problem has existed since at least 2.36.3 and is still present in 2.47.4.
Review of attachment 318497 [details] [review]: In all realistic situations, (fd > 0) will hold. Only if you’ve closed stdout/stdin/stderr could (fd == 0). But your patch is valid; thanks for submitting it. I’ll apply it and push to master.
I added a commit message and pushed to master, thanks.