1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2025-03-15 20:25:12 +01:00

g_file_set_contents: change {posix_ => }fallocate

Use fallocate() instead of posix_fallocate() so that we just fail
instead of getting the emulated version from the libc.

https://bugzilla.gnome.org/show_bug.cgi?id=701560
This commit is contained in:
Ryan Lortie 2013-06-03 22:55:20 -04:00
parent fc98c13fde
commit c828aef014
2 changed files with 3 additions and 3 deletions

@ -1056,7 +1056,7 @@ AC_MSG_RESULT($glib_ssize_type)
# Check for some functions # Check for some functions
AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem) AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid getresuid) AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid getresuid)
AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat posix_fallocate) AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
# Check for high-resolution sleep functions # Check for high-resolution sleep functions
AC_CHECK_FUNCS(splice) AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit) AC_CHECK_FUNCS(prlimit)

@ -1048,13 +1048,13 @@ write_to_temp_file (const gchar *contents,
goto out; goto out;
} }
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_FALLOCATE
if (length > 0) if (length > 0)
{ {
/* We do this on a 'best effort' basis... It may not be supported /* We do this on a 'best effort' basis... It may not be supported
* on the underlying filesystem. * on the underlying filesystem.
*/ */
(void) posix_fallocate (fd, 0, length); (void) fallocate (fd, 0, 0, length);
} }
#endif #endif
while (length > 0) while (length > 0)