|
|
b2d430 |
From ce5063550ef45f7abb3ec2ec3cb52a190bb38af5 Mon Sep 17 00:00:00 2001
|
|
|
b2d430 |
From: Lukas Slebodnik <lslebodn@redhat.com>
|
|
|
b2d430 |
Date: Mon, 25 Jul 2016 09:11:08 +0200
|
|
|
b2d430 |
Subject: [PATCH 36/44] Amend debug messages after failure of unlink
|
|
|
b2d430 |
MIME-Version: 1.0
|
|
|
b2d430 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b2d430 |
Content-Transfer-Encoding: 8bit
|
|
|
b2d430 |
|
|
|
b2d430 |
Some messages did not have errno or name of problematic file.
|
|
|
b2d430 |
There was also improper use of negative value.
|
|
|
b2d430 |
The function strerror was called with -1 instead of errno
|
|
|
b2d430 |
|
|
|
b2d430 |
Reviewed-by: Petr Čech <pcech@redhat.com>
|
|
|
b2d430 |
---
|
|
|
b2d430 |
src/providers/ipa/ipa_init.c | 5 +++--
|
|
|
b2d430 |
src/responder/common/responder_common.c | 3 ++-
|
|
|
b2d430 |
src/responder/secrets/local.c | 1 +
|
|
|
b2d430 |
src/sbus/sssd_dbus_server.c | 9 +++++----
|
|
|
b2d430 |
src/tools/files.c | 3 ++-
|
|
|
b2d430 |
src/tools/tools_mc_util.c | 7 ++++---
|
|
|
b2d430 |
src/util/util.c | 6 ++++--
|
|
|
b2d430 |
7 files changed, 21 insertions(+), 13 deletions(-)
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
|
|
|
b2d430 |
index 959cdb4a7c40c1be03dd1e7c66dee6e65ca76607..c31e195f48b2f369de1b78b38a0f3522d73d8dce 100644
|
|
|
b2d430 |
--- a/src/providers/ipa/ipa_init.c
|
|
|
b2d430 |
+++ b/src/providers/ipa/ipa_init.c
|
|
|
b2d430 |
@@ -440,9 +440,10 @@ static void cleanup_ipa_preauth_indicator(void)
|
|
|
b2d430 |
|
|
|
b2d430 |
ret = unlink(PAM_PREAUTH_INDICATOR);
|
|
|
b2d430 |
if (ret != EOK) {
|
|
|
b2d430 |
+ ret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_OP_FAILURE,
|
|
|
b2d430 |
- "Failed to remove preauth indicator file [%s].\n",
|
|
|
b2d430 |
- PAM_PREAUTH_INDICATOR);
|
|
|
b2d430 |
+ "Failed to remove preauth indicator file [%s] %d [%s].\n",
|
|
|
b2d430 |
+ PAM_PREAUTH_INDICATOR, ret, sss_strerror(ret));
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
|
|
|
b2d430 |
index 02a64368cad60990436497865aa0c772a39cde5a..7f6264ae70e5073063b5cfcd73098eefad2ce653 100644
|
|
|
b2d430 |
--- a/src/responder/common/responder_common.c
|
|
|
b2d430 |
+++ b/src/responder/common/responder_common.c
|
|
|
b2d430 |
@@ -629,7 +629,8 @@ int create_pipe_fd(const char *sock_name, int *_fd, mode_t umaskval)
|
|
|
b2d430 |
if (ret != 0 && errno != ENOENT) {
|
|
|
b2d430 |
ret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
b2d430 |
- "Cannot remove old socket (errno=%d), bind might fail!\n", ret);
|
|
|
b2d430 |
+ "Cannot remove old socket (errno=%d [%s]), bind might fail!\n",
|
|
|
b2d430 |
+ ret, sss_strerror(ret));
|
|
|
b2d430 |
}
|
|
|
b2d430 |
|
|
|
b2d430 |
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
|
|
|
b2d430 |
diff --git a/src/responder/secrets/local.c b/src/responder/secrets/local.c
|
|
|
b2d430 |
index 2a85ac06945322265fbd1012c9697728c37b77a0..470aec0e195a54dd2af2b929ff1b7a304331a214 100644
|
|
|
b2d430 |
--- a/src/responder/secrets/local.c
|
|
|
b2d430 |
+++ b/src/responder/secrets/local.c
|
|
|
b2d430 |
@@ -627,6 +627,7 @@ int generate_master_key(const char *filename, size_t size)
|
|
|
b2d430 |
ret = unlink(filename);
|
|
|
b2d430 |
/* non-fatal failure */
|
|
|
b2d430 |
if (ret != EOK) {
|
|
|
b2d430 |
+ ret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
b2d430 |
"Failed to remove file: %s - %d [%s]!\n",
|
|
|
b2d430 |
filename, ret, sss_strerror(ret));
|
|
|
b2d430 |
diff --git a/src/sbus/sssd_dbus_server.c b/src/sbus/sssd_dbus_server.c
|
|
|
b2d430 |
index 0a1cace415b3514a6904e92a2d879538ce51a593..6cc4172a07118ff99bb6f122c3a1de25cee18c8c 100644
|
|
|
b2d430 |
--- a/src/sbus/sssd_dbus_server.c
|
|
|
b2d430 |
+++ b/src/sbus/sssd_dbus_server.c
|
|
|
b2d430 |
@@ -103,8 +103,9 @@ create_socket_symlink(const char *filename, const char *symlink_filename)
|
|
|
b2d430 |
ret = unlink(symlink_filename);
|
|
|
b2d430 |
if (ret != 0) {
|
|
|
b2d430 |
ret = errno;
|
|
|
b2d430 |
- DEBUG(SSSDBG_CRIT_FAILURE, "Cannot remove old symlink: [%d][%s].\n",
|
|
|
b2d430 |
- ret, strerror(ret));
|
|
|
b2d430 |
+ DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
+ "Cannot remove old symlink '%s': [%d][%s].\n",
|
|
|
b2d430 |
+ symlink_filename, ret, strerror(ret));
|
|
|
b2d430 |
return EIO;
|
|
|
b2d430 |
}
|
|
|
b2d430 |
errno = 0;
|
|
|
b2d430 |
@@ -351,8 +352,8 @@ done:
|
|
|
b2d430 |
if (tmp_ret != EOK) {
|
|
|
b2d430 |
tmp_ret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
b2d430 |
- "Failed to remove symbolic link: %d [%s]!\n",
|
|
|
b2d430 |
- tmp_ret, sss_strerror(tmp_ret));
|
|
|
b2d430 |
+ "Failed to remove symbolic link '%s': %d [%s]!\n",
|
|
|
b2d430 |
+ symlink_filename, tmp_ret, sss_strerror(tmp_ret));
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
talloc_free(tmp_ctx);
|
|
|
b2d430 |
diff --git a/src/tools/files.c b/src/tools/files.c
|
|
|
b2d430 |
index 5364f5c0dd53aad71452e18b8d7f1f04532132a4..8f1aa68beeb2676b56733f49550de170b404c789 100644
|
|
|
b2d430 |
--- a/src/tools/files.c
|
|
|
b2d430 |
+++ b/src/tools/files.c
|
|
|
b2d430 |
@@ -225,7 +225,8 @@ static int remove_tree_with_ctx(TALLOC_CTX *mem_ctx,
|
|
|
b2d430 |
if (ret != 0) {
|
|
|
b2d430 |
ret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
- "Removing file failed: [%d][%s]\n", ret, strerror(ret));
|
|
|
b2d430 |
+ "Removing file failed '%s': [%d][%s]\n",
|
|
|
b2d430 |
+ result->d_name, ret, strerror(ret));
|
|
|
b2d430 |
goto fail;
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
diff --git a/src/tools/tools_mc_util.c b/src/tools/tools_mc_util.c
|
|
|
b2d430 |
index ce899eb3c674afe8271be526dc83aa909cbecf89..2516a1981ddd965d4cae8c469ed79aaef8fa7193 100644
|
|
|
b2d430 |
--- a/src/tools/tools_mc_util.c
|
|
|
b2d430 |
+++ b/src/tools/tools_mc_util.c
|
|
|
b2d430 |
@@ -117,10 +117,11 @@ done:
|
|
|
b2d430 |
if (ret == EOK) {
|
|
|
b2d430 |
pret = unlink(mc_filename);
|
|
|
b2d430 |
if (pret == -1) {
|
|
|
b2d430 |
+ pret = errno;
|
|
|
b2d430 |
DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
b2d430 |
- "Failed to unlink file %s. "
|
|
|
b2d430 |
- "Will be unlinked later by sssd_nss.\n",
|
|
|
b2d430 |
- mc_filename);
|
|
|
b2d430 |
+ "Failed to unlink file %s, %d [%s]. "
|
|
|
b2d430 |
+ "Will be unlinked later by sssd_nss.\n",
|
|
|
b2d430 |
+ mc_filename, pret, strerror(pret));
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
diff --git a/src/util/util.c b/src/util/util.c
|
|
|
b2d430 |
index 89abfe734873161008dc9a7a42e7a87364f8074a..d4878bfaf4f0e92672756f12137d79ec65ef48f6 100644
|
|
|
b2d430 |
--- a/src/util/util.c
|
|
|
b2d430 |
+++ b/src/util/util.c
|
|
|
b2d430 |
@@ -990,13 +990,15 @@ static int unlink_dbg(const char *filename)
|
|
|
b2d430 |
|
|
|
b2d430 |
ret = unlink(filename);
|
|
|
b2d430 |
if (ret != 0) {
|
|
|
b2d430 |
- if (errno == 2) {
|
|
|
b2d430 |
+ ret = errno;
|
|
|
b2d430 |
+ if (ret == ENOENT) {
|
|
|
b2d430 |
DEBUG(SSSDBG_TRACE_INTERNAL,
|
|
|
b2d430 |
"File already removed: [%s]\n", filename);
|
|
|
b2d430 |
return 0;
|
|
|
b2d430 |
} else {
|
|
|
b2d430 |
DEBUG(SSSDBG_CRIT_FAILURE,
|
|
|
b2d430 |
- "Cannot remove temporary file [%s]\n", filename);
|
|
|
b2d430 |
+ "Cannot remove temporary file [%s] %d [%s]\n",
|
|
|
b2d430 |
+ filename, ret, strerror(ret));
|
|
|
b2d430 |
return -1;
|
|
|
b2d430 |
}
|
|
|
b2d430 |
}
|
|
|
b2d430 |
--
|
|
|
b2d430 |
2.4.11
|
|
|
b2d430 |
|