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

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