X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gfileutils.c;h=86b33bc00baa30cb3d163c5064d285d27bdaded3;hb=525689823d7dcd269b052c58545a5ff1d8db65f8;hp=7ea229f0d8d5455661b812ae6b07e76ba026c875;hpb=1c391cc69846713b0406545146ea232efc5f34e2;p=platform%2Fupstream%2Fglib.git diff --git a/gfileutils.c b/gfileutils.c index 7ea229f..86b33bc 100644 --- a/gfileutils.c +++ b/gfileutils.c @@ -117,10 +117,25 @@ g_file_error_quark (void) return q; } +/** + * g_file_error_from_errno: + * @err_no: an "errno" value + * + * Gets a #GFileError constant based on the passed-in errno. + * For example, if you pass in EEXIST this function returns + * #G_FILE_ERROR_EXIST. Unlike errno values, you can portably + * assume that all #GFileError values will exist. + * + * Normally a #GFileError value goes into a #GError returned + * from a function that manipulates files. So you would use + * g_file_error_from_errno() when constructing a #GError. + * + * Return value: #GFileError corresponding to the given errno + **/ GFileError -g_file_error_from_errno (gint en) +g_file_error_from_errno (gint err_no) { - switch (en) + switch (err_no) { #ifdef EEXIST case EEXIST: @@ -378,7 +393,8 @@ get_contents_posix (const gchar *filename, struct stat stat_buf; gint fd; - fd = open (filename, O_RDONLY); + /* O_BINARY useful on Cygwin */ + fd = open (filename, O_RDONLY|O_BINARY); if (fd < 0) {