Blame SOURCES/0160-dbus-api-unify-reporting-of-errors.patch

06486d
From c4ed648911bf4fb7b5c2c9596bd2418f4f836e00 Mon Sep 17 00:00:00 2001
06486d
From: Jakub Filak <jfilak@redhat.com>
06486d
Date: Tue, 11 Aug 2015 09:54:55 +0200
06486d
Subject: [PATCH] dbus-api: unify reporting of errors
06486d
06486d
User ERR_PTR for failures in all functions because some of the functions
06486d
use NULL as a valid response (NULL is an empty GList).
06486d
06486d
Related: rhbz#1224984
06486d
06486d
Signed-off-by: Jakub Filak <jfilak@redhat.com>
06486d
---
06486d
 src/include/libabrt.h      | 12 +++++++-----
06486d
 src/lib/problem_api_dbus.c |  2 +-
06486d
 2 files changed, 8 insertions(+), 6 deletions(-)
06486d
06486d
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
06486d
index 5d74aa3..3b17a64 100644
06486d
--- a/src/include/libabrt.h
06486d
+++ b/src/include/libabrt.h
06486d
@@ -135,7 +135,7 @@ void koops_print_suspicious_strings_filtered(const regex_t **filterout);
06486d
 
06486d
   Requires authorization
06486d
 
06486d
-  @return 0 if successfull non-zeru on failure
06486d
+  @return 0 if successful; non-zero on failure
06486d
 */
06486d
 int chown_dir_over_dbus(const char *problem_dir_path);
06486d
 
06486d
@@ -161,7 +161,8 @@ char *load_text_over_dbus(const char *problem_id, const char *element_name);
06486d
  @brief Delets multiple problems specified by their id (as returned from problem_data_save)
06486d
 
06486d
  @param problem_dir_paths List of problem ids
06486d
- @return 0 if operation was successfull, non-zero on failure
06486d
+
06486d
+ @return 0 if operation was successful, non-zero on failure
06486d
 */
06486d
 
06486d
 int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
06486d
@@ -169,14 +170,14 @@ int delete_problem_dirs_over_dbus(const GList *problem_dir_paths);
06486d
 /**
06486d
   @brief Fetches problem information for specified problem id
06486d
 
06486d
-  @return problem_data_t or NULL on failure
06486d
+  @return a valid pointer to problem_data_t or ERR_PTR on failure
06486d
 */
06486d
 problem_data_t *get_problem_data_dbus(const char *problem_dir_path);
06486d
 
06486d
 /**
06486d
   @brief Fetches full problem data for specified problem id
06486d
 
06486d
-  @return problem_data_t or ERR_PTR on failure
06486d
+  @return a valid pointer to problem_data_t or ERR_PTR on failure
06486d
 */
06486d
 problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
06486d
 
06486d
@@ -184,7 +185,8 @@ problem_data_t *get_full_problem_data_over_dbus(const char *problem_dir_path);
06486d
   @brief Fetches all problems from problem database
06486d
 
06486d
   @param authorize If set to true will try to fetch even problems owned by other users (will require root authorization over policy kit)
06486d
-  @return List of problem ids or NULL on failure
06486d
+
06486d
+  @return List of problem ids or ERR_PTR on failure (NULL is an empty list)
06486d
 */
06486d
 GList *get_problems_over_dbus(bool authorize);
06486d
 
06486d
diff --git a/src/lib/problem_api_dbus.c b/src/lib/problem_api_dbus.c
06486d
index 5148932..dd06633 100644
06486d
--- a/src/lib/problem_api_dbus.c
06486d
+++ b/src/lib/problem_api_dbus.c
06486d
@@ -132,7 +132,7 @@ problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
06486d
     {
06486d
         error_msg(_("Can't get problem data from abrt-dbus: %s"), error->message);
06486d
         g_error_free(error);
06486d
-        return NULL;
06486d
+        return ERR_PTR;
06486d
     }
06486d
 
06486d
     problem_data_t *pd = problem_data_new();
06486d
-- 
06486d
2.4.3
06486d