|
Matej Habrnal |
36fd7e |
From 0c3a29b70992627481af789dab50247728bcedf1 Mon Sep 17 00:00:00 2001
|
|
Matej Habrnal |
36fd7e |
From: Jakub Filak <jfilak@redhat.com>
|
|
Matej Habrnal |
36fd7e |
Date: Tue, 11 Aug 2015 09:54:55 +0200
|
|
Matej Habrnal |
36fd7e |
Subject: [PATCH] dbus-api: unify reporting of errors
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
User ERR_PTR for failures in all functions because some of the functions
|
|
Matej Habrnal |
36fd7e |
use NULL as a valid response (NULL is an empty GList).
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
Related: rhbz#1224984
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
Matej Habrnal |
36fd7e |
---
|
|
Matej Habrnal |
36fd7e |
src/include/libabrt.h | 16 +++++++++-------
|
|
Matej Habrnal |
36fd7e |
src/lib/problem_api_dbus.c | 2 +-
|
|
Matej Habrnal |
36fd7e |
2 files changed, 10 insertions(+), 8 deletions(-)
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
|
|
Matej Habrnal |
36fd7e |
index 4e73a0d..da565f9 100644
|
|
Matej Habrnal |
36fd7e |
--- a/src/include/libabrt.h
|
|
Matej Habrnal |
36fd7e |
+++ b/src/include/libabrt.h
|
|
Matej Habrnal |
36fd7e |
@@ -163,7 +163,7 @@ void koops_print_suspicious_strings_filtered(const regex_t **filterout);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
Requires authorization
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
- @return 0 if successfull non-zeru on failure
|
|
Matej Habrnal |
36fd7e |
+ @return 0 if successful; non-zero on failure
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
int chown_dir_over_dbus(const char *problem_dir_path);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
@@ -181,7 +181,7 @@ int test_exist_over_dbus(const char *problem_id, const char *element_name);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
Might require authorization
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
- @return Positive number if such the proble is complete, 0 if doesn't and negative number if an error occurs.
|
|
Matej Habrnal |
36fd7e |
+ @return Positive number if the problem is complete, 0 if doesn't and negative number if an error occurs.
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
int dbus_problem_is_complete(const char *problem_id);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
@@ -198,7 +198,8 @@ char *load_text_over_dbus(const char *problem_id, const char *element_name);
|
|
Matej Habrnal |
36fd7e |
@brief Delets multiple problems specified by their id (as returned from problem_data_save)
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
@param problem_dir_paths List of problem ids
|
|
Matej Habrnal |
36fd7e |
- @return 0 if operation was successfull, non-zero on failure
|
|
Matej Habrnal |
36fd7e |
+
|
|
Matej Habrnal |
36fd7e |
+ @return 0 if operation was successful, non-zero on failure
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
|
|
Matej Habrnal |
36fd7e |
@@ -206,21 +207,21 @@ int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
|
|
Matej Habrnal |
36fd7e |
/**
|
|
Matej Habrnal |
36fd7e |
@brief Fetches given problem elements for specified problem id
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
- @return on failures returns non zero value and emits error message
|
|
Matej Habrnal |
36fd7e |
+ @return returns non-zero value on failures and prints error message
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
int fill_problem_data_over_dbus(const char *problem_dir_path, const char **elements, problem_data_t *problem_data);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
/**
|
|
Matej Habrnal |
36fd7e |
@brief Fetches problem information for specified problem id
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
- @return problem_data_t or NULL on failure
|
|
Matej Habrnal |
36fd7e |
+ @return a valid pointer to problem_data_t or ERR_PTR on failure
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
/**
|
|
Matej Habrnal |
36fd7e |
@brief Fetches full problem data for specified problem id
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
- @return problem_data_t or ERR_PTR on failure
|
|
Matej Habrnal |
36fd7e |
+ @return a valid pointer to problem_data_t or ERR_PTR on failure
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
@@ -228,7 +229,8 @@ problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
|
|
Matej Habrnal |
36fd7e |
@brief Fetches all problems from problem database
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
@param authorize If set to true will try to fetch even problems owned by other users (will require root authorization over policy kit)
|
|
Matej Habrnal |
36fd7e |
- @return List of problem ids or NULL on failure
|
|
Matej Habrnal |
36fd7e |
+
|
|
Matej Habrnal |
36fd7e |
+ @return List of problem ids or ERR_PTR on failure (NULL is an empty list)
|
|
Matej Habrnal |
36fd7e |
*/
|
|
Matej Habrnal |
36fd7e |
GList *get_problems_over_dbus(bool authorize);
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
diff --git a/src/lib/problem_api_dbus.c b/src/lib/problem_api_dbus.c
|
|
Matej Habrnal |
36fd7e |
index ce5c47b..0bf86e2 100644
|
|
Matej Habrnal |
36fd7e |
--- a/src/lib/problem_api_dbus.c
|
|
Matej Habrnal |
36fd7e |
+++ b/src/lib/problem_api_dbus.c
|
|
Matej Habrnal |
36fd7e |
@@ -165,7 +165,7 @@ problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
|
|
Matej Habrnal |
36fd7e |
{
|
|
Matej Habrnal |
36fd7e |
error_msg(_("Can't get problem data from abrt-dbus"));
|
|
Matej Habrnal |
36fd7e |
problem_data_free(pd);
|
|
Matej Habrnal |
36fd7e |
- return NULL;
|
|
Matej Habrnal |
36fd7e |
+ return ERR_PTR;
|
|
Matej Habrnal |
36fd7e |
}
|
|
Matej Habrnal |
36fd7e |
|
|
Matej Habrnal |
36fd7e |
return pd;
|
|
Matej Habrnal |
36fd7e |
--
|
|
Matej Habrnal |
36fd7e |
2.4.3
|
|
Matej Habrnal |
36fd7e |
|