mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 06:00:32 +01:00
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: 21358edc54
This commit is contained in:
parent
ec91f950b8
commit
0a0893280b
1 changed files with 3 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue