glocalfile: Only use O_DIRECTORY if available

Solaris 10 for example doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=708860
This commit is contained in:
William Orr
2013-09-26 11:02:06 -07:00
committed by Colin Walters
parent e631507c50
commit 7eb1e5fc5b
2 changed files with 17 additions and 1 deletions

View File

@@ -2699,7 +2699,11 @@ g_local_file_measure_size_of_file (gint parent_fd,
return FALSE;
#ifdef AT_FDCWD
dir_fd = openat (parent_fd, name->data, O_RDONLY | O_DIRECTORY);
#ifdef HAVE_OPEN_O_DIRECTORY
dir_fd = openat (parent_fd, name->data, O_RDONLY|O_DIRECTORY);
#else
dir_fd = openat (parent_fd, name->data, O_RDONLY);
#endif
if (dir_fd < 0)
return g_local_file_measure_size_error (state->flags, errno, name, error);
#endif