g_file_set_contents: change {posix_ => }fallocate
authorRyan Lortie <desrt@desrt.ca>
Tue, 4 Jun 2013 02:55:20 +0000 (22:55 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Jun 2013 22:15:46 +0000 (18:15 -0400)
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

configure.ac
glib/gfileutils.c

index 51be1ff..3272660 100644 (file)
@@ -992,7 +992,7 @@ AC_MSG_RESULT(unsigned $glib_size_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)
index 67677fb..2980098 100644 (file)
@@ -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)