Commit 0a089328 authored by Beniamino Galvani's avatar Beniamino Galvani Committed by Thomas Haller

core: fix nm_utils_file_set_contents() handling of -1 length

nm_utils_file_set_contents() must compute the content size when
@length is -1.

Fixes: 21358edc
parent ec91f950
......@@ -4076,6 +4076,9 @@ nm_utils_file_set_contents (const gchar *filename,
g_return_val_if_fail (!error || !*error, FALSE);
g_return_val_if_fail (length >= -1, FALSE);
if (length == -1)
length = strlen (contents);
tmp_name = g_strdup_printf ("%s.XXXXXX", filename);
fd = g_mkstemp_full (tmp_name, O_RDWR, mode);
if (fd < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment