diff options
author | Vincent Untz <vuntz@novell.com> | 2010-02-19 16:06:44 +0100 |
---|---|---|
committer | Vincent Untz <vuntz@novell.com> | 2010-02-19 16:06:44 +0100 |
commit | d3ad5757aef2e203337409f1d2e222b91e320638 (patch) | |
tree | 705c89ffea72b5a3959bdf073cda12dd582aa951 | |
parent | 8d788b3d3bfb87f25c31a91d48e979e5749a7bd1 (diff) |
Make sure to return an error via dbus in case of failure
It might happen that the internal error string is empty and we still
fail. However, if we return an empty error string via dbus, the caller
will think it has succeeded. So we make sure to never return an empty
error string in case of failure.
-rw-r--r-- | src/cups-pk-helper-mechanism.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cups-pk-helper-mechanism.c b/src/cups-pk-helper-mechanism.c index ed644b8..7850f77 100644 --- a/src/cups-pk-helper-mechanism.c +++ b/src/cups-pk-helper-mechanism.c @@ -455,9 +455,11 @@ _cph_mechanism_return_error (CphMechanism *mechanism, { const char *error; - if (failed) + if (failed) { error = cph_cups_last_status_to_string (mechanism->priv->cups); - else + if (!error || error[0] == '\0') + error = "Unknown error" + } else error = ""; dbus_g_method_return (context, error); @@ -471,9 +473,11 @@ _cph_mechanism_return_error_and_value (CphMechanism *mechanism, { const char *error; - if (failed) + if (failed) { error = cph_cups_last_status_to_string (mechanism->priv->cups); - else + if (!error || error[0] == '\0') + error = "Unknown error" + } else error = ""; dbus_g_method_return (context, error, value); |