summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-06-03 22:55:20 -0400
committerRyan Lortie <desrt@desrt.ca>2013-06-03 22:55:20 -0400
commitc828aef014082c06f6a697ef4d0b92054d82b727 (patch)
tree34bfd57debcafef7fa633ca95febd99106c3572c
parentfc98c13fdec0e5ea7d8827be0eb1f1add31ad946 (diff)
downloadglib-c828aef014082c06f6a697ef4d0b92054d82b727.tar.gz
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
-rw-r--r--configure.ac2
-rw-r--r--glib/gfileutils.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 53b38bc4e..30c57d2ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,7 +1056,7 @@ AC_MSG_RESULT($glib_ssize_type)
# 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(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
AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit)
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index adf83d32e..7e5bedce9 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -1048,13 +1048,13 @@ write_to_temp_file (const gchar *contents,
goto out;
}
-#ifdef HAVE_POSIX_FALLOCATE
+#ifdef HAVE_FALLOCATE
if (length > 0)
{
/* We do this on a 'best effort' basis... It may not be supported
* on the underlying filesystem.
*/
- (void) posix_fallocate (fd, 0, length);
+ (void) fallocate (fd, 0, 0, length);
}
#endif
while (length > 0)