handle the unlikely case that no bytes are read from the file and allocate

2005-03-30  Sven Neumann  <sven@gimp.org>

	* glib/gfileutils.c (get_contents_stdio): handle the unlikely case
	that no bytes are read from the file and allocate an empty string.
This commit is contained in:
Sven Neumann
2005-03-30 21:59:40 +00:00
committed by Sven Neumann
parent 0f88e05d5b
commit ec2d35edc3
5 changed files with 23 additions and 0 deletions

View File

@@ -523,6 +523,9 @@ get_contents_stdio (const gchar *display_filename,
fclose (f);
if (total_bytes == 0)
str = g_new (gchar, 1);
str[total_bytes] = '\0';
if (length)