SF.net SVN: geany:[5454] trunk/src/utils.c

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Nov 30 18:25:17 UTC 2010


Revision: 5454
          http://geany.svn.sourceforge.net/geany/?rev=5454&view=rev
Author:   ntrel
Date:     2010-11-30 18:25:16 +0000 (Tue, 30 Nov 2010)

Log Message:
-----------
Add warning for utils_write_file() that g_file_set_contents() is a better choice because it handles disk exhaustion safely.

Modified Paths:
--------------
    trunk/src/utils.c

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2010-11-30 18:18:24 UTC (rev 5453)
+++ trunk/src/utils.c	2010-11-30 18:25:16 UTC (rev 5454)
@@ -217,15 +217,19 @@
 
 
 /**
- *  Writes the given @a text into a file with @a filename.
- *  If the file doesn't exist, it will be created.
- *  If it already exists, it will be overwritten.
+ * Writes @a text into a file named @a filename.
+ * If the file doesn't exist, it will be created.
+ * If it already exists, it will be overwritten.
  *
- *  @param filename The filename of the file to write, in locale encoding.
- *  @param text The text to write into the file.
+ * @warning You should use @c g_file_set_contents() instead if you don't need
+ * file permissions and other metadata to be preserved, as that always handles
+ * disk exhaustion safely.
  *
- *  @return 0 if the file was successfully written, otherwise the @c errno of the
- *          failed operation is returned.
+ * @param filename The filename of the file to write, in locale encoding.
+ * @param text The text to write into the file.
+ *
+ * @return 0 if the file was successfully written, otherwise the @c errno of the
+ *         failed operation is returned.
  **/
 gint utils_write_file(const gchar *filename, const gchar *text)
 {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list