GNOME Bugzilla – Bug 638768
fd < 0 to fd == -1 in gkeyfile.c
Last modified: 2011-06-03 20:03:04 UTC
In gkeyfile.c we have some statements: if (fd < 0). This is not precise according to the description of results of g_open() respectively POSIX open(). If an error occurred, the result is exactly -1. For example in wince, the file descriptors are valid with a value of fd < -1. But in such cases the program is aborted. That's not correct. Therefore and for real cross compatibility the statements in gkeyfile.c should be changed to: if (fd == -1).
A patch would be welcome.
Created attachment 177849 [details] [review] patch gkeyfile.c
The same pattern exists in some other files in glib, and also some places in gio.
Wow, CE uses negative fds? That's rather sadistic, but I assume it's mapping the file identifier from some other Windows-internal handle. Anyways Hanro, I have turned your patch into a "git format-patch" style patch and committed it. Please see: http://live.gnome.org/GnomeLove/SubmittingPatches for more information on submitting patches. It saves a lot of time if you write the commit message. commit 16bdb12e6dcb690d56baf52a34ba674052d39b6e Author: Hanro <hanro@gmx.de> Date: Thu Jun 2 15:44:19 2011 -0400 gkeyfile: Only test file descriptors against -1 Windows CE at least will return other (valid) negative values. Commit message written by Colin Walters <walters@verbum.org>