mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-02 02:38:03 +02: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(cherry picked from commit0a0893280b)
This commit is contained in:
parent
d2d7a0aafc
commit
b6a34b9c39
1 changed files with 3 additions and 0 deletions
|
|
@ -4100,6 +4100,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