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/settings/plugins/keyfile/nms-keyfile-utils.c | |
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/settings/plugins/keyfile/nms-keyfile-utils.c')
-rw-r--r-- | src/settings/plugins/keyfile/nms-keyfile-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/settings/plugins/keyfile/nms-keyfile-utils.c b/src/settings/plugins/keyfile/nms-keyfile-utils.c index ea03e1b611..eef6ae6e82 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-utils.c +++ b/src/settings/plugins/keyfile/nms-keyfile-utils.c @@ -266,7 +266,7 @@ nms_keyfile_nmmeta_write (const char *dirname, contents = g_key_file_to_data (kf, &length, NULL); - if (!nm_utils_file_set_contents (full_filename, contents, length, 0600, NULL)) { + if (nm_utils_file_set_contents (full_filename, contents, length, 0600, NULL) < 0) { NM_SET_OUT (out_full_filename, g_steal_pointer (&full_filename_tmp)); return FALSE; } |