diff options
author | Pavel Reichl <preichl@redhat.com> | 2014-11-28 13:17:44 +0000 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-11-28 16:16:37 +0100 |
commit | aff8b0e3b41644c70704b78e15501779d52b6ff4 (patch) | |
tree | f0ae0696f623a5bfc36f18f7fea68af904a67f1d /src/sbus/sssd_dbus_server.c | |
parent | 5b4c6f22cb576a11037c7fa940fe0ba09e643e77 (diff) | |
download | sssd-aff8b0e3b41644c70704b78e15501779d52b6ff4.tar.gz sssd-aff8b0e3b41644c70704b78e15501779d52b6ff4.tar.xz sssd-aff8b0e3b41644c70704b78e15501779d52b6ff4.zip |
Fix: always check return value of unlink()
Resolves:
https://fedorahosted.org/sssd/ticket/2506
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/sbus/sssd_dbus_server.c')
-rw-r--r-- | src/sbus/sssd_dbus_server.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/sbus/sssd_dbus_server.c b/src/sbus/sssd_dbus_server.c index 18fb98df6..137524892 100644 --- a/src/sbus/sssd_dbus_server.c +++ b/src/sbus/sssd_dbus_server.c @@ -192,7 +192,7 @@ int sbus_new_server(TALLOC_CTX *mem_ctx, DBusError dbus_error; dbus_bool_t dbret; char *tmp; - int ret; + int ret, tmp_ret; char *filename; char *symlink_filename = NULL; const char *socket_address; @@ -343,9 +343,17 @@ int sbus_new_server(TALLOC_CTX *mem_ctx, *_server = talloc_steal(mem_ctx, server); ret = EOK; + done: if (ret != EOK && symlink_filename) { - unlink(symlink_filename); + tmp_ret = unlink(symlink_filename); + /* non-fatal failure */ + if (tmp_ret != EOK) { + tmp_ret = errno; + DEBUG(SSSDBG_MINOR_FAILURE, + "Failed to remove symbolic link: %d [%s]!\n", + tmp_ret, sss_strerror(tmp_ret)); + } } talloc_free(tmp_ctx); return ret; |