diff options
| author | Sjoerd Simons <sjoerd@luon.net> | 2013-10-25 21:20:58 +0200 |
|---|---|---|
| committer | Sjoerd Simons <sjoerd@luon.net> | 2013-10-25 21:20:58 +0200 |
| commit | a4256940da049f91bbbea5e53e469a59ea9c10f7 (patch) | |
| tree | 2211c102aea3a33f34f960f48c8b8a55daccd97b /src/settings/plugins/keyfile/writer.c | |
| parent | 8d275584fc94f398f0a7c990dcd057533d9a5856 (diff) | |
Imported Upstream version 0.9.8.8 upstream/0.9.8.8
Diffstat (limited to 'src/settings/plugins/keyfile/writer.c')
| -rw-r--r-- | src/settings/plugins/keyfile/writer.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index 0b8c1592..38061a5d 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -990,6 +990,7 @@ _internal_write_connection (NMConnection *connection, char *filename = NULL, *path; const char *id; WriteInfo info; + GError *local_err = NULL; if (out_path) g_return_val_if_fail (*out_path == NULL, FALSE); @@ -1054,7 +1055,16 @@ _internal_write_connection (NMConnection *connection, if (existing_path != NULL && strcmp (path, existing_path) != 0) unlink (existing_path); - g_file_set_contents (path, data, len, error); + g_file_set_contents (path, data, len, &local_err); + if (local_err) { + g_set_error (error, KEYFILE_PLUGIN_ERROR, 0, + "%s.%d: error writing to file '%s': %s", __FILE__, __LINE__, + path, local_err->message); + g_error_free (local_err); + g_free (path); + goto out; + } + if (chown (path, owner_uid, owner_grp) < 0) { g_set_error (error, KEYFILE_PLUGIN_ERROR, 0, "%s.%d: error chowning '%s': %d", __FILE__, __LINE__, |