diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-08 11:09:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-08 11:59:59 +0200 |
commit | b216abb012b97a7e0e50b969e4a04c8b11a4cbe9 (patch) | |
tree | b32f160bc5f97f56723f4e28fb1155976cad6e60 /libnm-core/nm-crypto.c | |
parent | 1bad35061fb3d0807048601b404619ad816be28b (diff) | |
download | NetworkManager-b216abb012b97a7e0e50b969e4a04c8b11a4cbe9.tar.gz |
shared,all: return boolean success from nm_utils_file_get_contents()
... and nm_utils_fd_get_contents() and nm_utils_file_set_contents().
Don't mix negative errno return value with a GError output. Instead,
return a boolean result indicating success or failure.
Also, optionally
- output GError
- set out_errsv to the positive errno (or 0 on success)
Obviously, the return value and the output arguments (contents, length,
out_errsv, error) must all agree in their success/failure result.
That means, you may check any of the return value, out_errsv, error, and
contents to reliably detect failure or success.
Also note that out_errsv gives the positive(!) errno. But you probably
shouldn't care about the distinction and use nm_errno_native() either
way to normalize the value.
Diffstat (limited to 'libnm-core/nm-crypto.c')
-rw-r--r-- | libnm-core/nm-crypto.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libnm-core/nm-crypto.c b/libnm-core/nm-crypto.c index e0c3b7fde5..37ffd6b121 100644 --- a/libnm-core/nm-crypto.c +++ b/libnm-core/nm-crypto.c @@ -444,7 +444,8 @@ file_read_contents (const char *filename, NM_UTILS_FILE_GET_CONTENTS_FLAG_SECRET, &out_contents->str, &out_contents->len, - error) >= 0; + NULL, + error); } GBytes * |