Don't try and generate a dotfile from the name -- it doesn't work with
authorSoeren Sandmann <sandmann@redhat.com>
Sat, 12 Mar 2005 05:45:32 +0000 (05:45 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Sat, 12 Mar 2005 05:45:32 +0000 (05:45 +0000)
Fri Mar 11 23:51:12 2005  Soeren Sandmann  <sandmann@redhat.com>

* glib/gfileutils.c (write_to_temp_file): Don't try and generate
a dotfile from the name -- it doesn't work with absolute
paths. Also make documentation indicate that symlinks will be
overwritten. Both pointed out by Alexis S. L. Carvalho.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-8
glib/gfileutils.c

index 30ceb08..bbd85e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Mar 11 23:51:12 2005  Soeren Sandmann  <sandmann@redhat.com>
+
+       * glib/gfileutils.c (write_to_temp_file): Don't try and generate
+       a dotfile from the name -- it doesn't work with absolute
+       paths. Also make documentation indicate that symlinks will be
+       overwritten. Both pointed out by Alexis S. L. Carvalho.
+
 2005-03-11  Matthias Clasen  <mclasen@redhat.com>
 
        * m4macros/glib-gettext.m4: Avoid stupid compiler complaints
index 30ceb08..bbd85e8 100644 (file)
@@ -1,3 +1,10 @@
+Fri Mar 11 23:51:12 2005  Soeren Sandmann  <sandmann@redhat.com>
+
+       * glib/gfileutils.c (write_to_temp_file): Don't try and generate
+       a dotfile from the name -- it doesn't work with absolute
+       paths. Also make documentation indicate that symlinks will be
+       overwritten. Both pointed out by Alexis S. L. Carvalho.
+
 2005-03-11  Matthias Clasen  <mclasen@redhat.com>
 
        * m4macros/glib-gettext.m4: Avoid stupid compiler complaints
index 30ceb08..bbd85e8 100644 (file)
@@ -1,3 +1,10 @@
+Fri Mar 11 23:51:12 2005  Soeren Sandmann  <sandmann@redhat.com>
+
+       * glib/gfileutils.c (write_to_temp_file): Don't try and generate
+       a dotfile from the name -- it doesn't work with absolute
+       paths. Also make documentation indicate that symlinks will be
+       overwritten. Both pointed out by Alexis S. L. Carvalho.
+
 2005-03-11  Matthias Clasen  <mclasen@redhat.com>
 
        * m4macros/glib-gettext.m4: Avoid stupid compiler complaints
index 30ceb08..bbd85e8 100644 (file)
@@ -1,3 +1,10 @@
+Fri Mar 11 23:51:12 2005  Soeren Sandmann  <sandmann@redhat.com>
+
+       * glib/gfileutils.c (write_to_temp_file): Don't try and generate
+       a dotfile from the name -- it doesn't work with absolute
+       paths. Also make documentation indicate that symlinks will be
+       overwritten. Both pointed out by Alexis S. L. Carvalho.
+
 2005-03-11  Matthias Clasen  <mclasen@redhat.com>
 
        * m4macros/glib-gettext.m4: Avoid stupid compiler complaints
index 415d6fe..f9f6756 100644 (file)
@@ -841,7 +841,7 @@ rename_file (const char *old_name,
 
 static gchar *
 write_to_temp_file (const gchar *contents,
-                   gsize length,
+                   gssize length,
                    const gchar *template,
                    GError **err)
 {
@@ -854,7 +854,7 @@ write_to_temp_file (const gchar *contents,
 
   retval = NULL;
   
-  tmp_name = g_strdup_printf (".%s.XXXXXX", template);
+  tmp_name = g_strdup_printf ("%s.XXXXXX", template);
 
   errno = 0;
   fd = g_mkstemp (tmp_name);
@@ -954,7 +954,8 @@ write_to_temp_file (const gchar *contents,
  * <listitem>
  *    On Unix, if @filename already exists hard links to @filename will break.
  *    Also since the file is recreated, existing permissions, access control
- *    lists, metadata etc. may be lost.
+ *    lists, metadata etc. may be lost. If @filename is a symbolic link,
+ *    the link itself will be replaced, not the linked file.
  * </listitem>
  * <listitem>
  *   On Windows renaming a file will not remove an existing file with the
@@ -989,7 +990,8 @@ g_file_replace (const gchar *filename,
   g_return_val_if_fail (filename != NULL, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
   g_return_val_if_fail (contents != NULL || length == 0, FALSE);
+  g_return_val_if_fail (length >= -1, FALSE);
+  
   if (length == -1)
     length = strlen (contents);