diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-01 10:59:36 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-08 10:53:03 +0200 |
commit | 1bad35061fb3d0807048601b404619ad816be28b (patch) | |
tree | 112b58d4a4199f328dab4ae02d7309913a3f059c /src/initrd | |
parent | 041a95229722c57a21492f69d3fbb9805bfe05e6 (diff) | |
download | NetworkManager-1bad35061fb3d0807048601b404619ad816be28b.tar.gz |
shared: let nm_utils_file_set_contents() return a errno error code
nm_utils_file_set_contents() is a re-implementation of g_file_set_contents(),
as such it returned merely a boolean success value.
It's sometimes interesting to get the native error code. Let the function
deviate from glib's original g_file_set_contents() and return the error code
(as negative value) instead.
This requires all callers to change. Also, it's potentially a dangerous
change, as this is easy to miss.
Note that nm_utils_file_get_contents() also returns an errno, and
already deviates from g_file_get_contents() in the same way. This patch
resolves at least the inconsistency with nm_utils_file_get_contents().
Diffstat (limited to 'src/initrd')
-rw-r--r-- | src/initrd/nm-initrd-generator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c index c916459d5c..6a1bf35a0d 100644 --- a/src/initrd/nm-initrd-generator.c +++ b/src/initrd/nm-initrd-generator.c @@ -63,7 +63,7 @@ output_conn (gpointer key, gpointer value, gpointer user_data) filename = nm_keyfile_utils_create_filename (basename, TRUE); full_filename = g_build_filename (connections_dir, filename, NULL); - if (!nm_utils_file_set_contents (full_filename, data, len, 0600, &error)) + if (nm_utils_file_set_contents (full_filename, data, len, 0600, &error) < 0) goto err_out; } else g_print ("\n*** Connection '%s' ***\n\n%s", basename, data); |