|
|
4b6aa8 |
From 04c86e6e8e45af873f8edc80cf12f0394b406183 Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Date: Thu, 13 Aug 2015 12:23:05 +0200
|
|
|
4b6aa8 |
Subject: [PATCH] dd: don't warn about missing 'type' if the locking fails
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
The warning is printed out at least 10 times and makes only a little
|
|
|
4b6aa8 |
sense to system administrators. abrtd follows those warnings with "$path
|
|
|
4b6aa8 |
is not a valid problem directory" message which is a sufficient way to
|
|
|
4b6aa8 |
tell the administrators to remove that directory.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related: #1243280
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/lib/dump_dir.c | 11 ++++++++++-
|
|
|
4b6aa8 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
|
|
|
4b6aa8 |
index 0575f11..9096853 100644
|
|
|
4b6aa8 |
--- a/src/lib/dump_dir.c
|
|
|
4b6aa8 |
+++ b/src/lib/dump_dir.c
|
|
|
4b6aa8 |
@@ -303,7 +303,16 @@ static const char *dd_check(struct dump_dir *dd)
|
|
|
4b6aa8 |
return FILENAME_TIME;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- dd->dd_type = load_text_file_at(dd->dd_fd, FILENAME_TYPE, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
|
|
|
4b6aa8 |
+ /* Do not warn about missing 'type' file in non-verbose modes.
|
|
|
4b6aa8 |
+ *
|
|
|
4b6aa8 |
+ * Handling of FILENAME_TYPE should be consistent with handling of
|
|
|
4b6aa8 |
+ * FILENAME_TIME in the function parse_time_file_at() where the missing
|
|
|
4b6aa8 |
+ * file message is printed only if VERB2 is satisfied.
|
|
|
4b6aa8 |
+ */
|
|
|
4b6aa8 |
+ int load_flags = DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE;
|
|
|
4b6aa8 |
+ if (g_verbose < 2) load_flags |= DD_FAIL_QUIETLY_ENOENT;
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ dd->dd_type = load_text_file_at(dd->dd_fd, FILENAME_TYPE, load_flags);
|
|
|
4b6aa8 |
if (!dd->dd_type || (strlen(dd->dd_type) == 0))
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
log_debug("Missing or empty file: "FILENAME_TYPE);
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
2.4.3
|
|
|
4b6aa8 |
|