+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
+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
+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
+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
static gchar *
write_to_temp_file (const gchar *contents,
- gsize length,
+ gssize length,
const gchar *template,
GError **err)
{
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);
* <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
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);