>From e9d55b0da86372e0b688c3cf24959be05e8c35f6 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 24 Jun 2014 14:28:51 +0200 Subject: [PATCH 3/7] IFP: Return a specific value on failure connecting to the system bus We need to treat the failure to connect to the system bus as non-fatal. In this commit, we introduce a special error code and only print a DEBUG message when this error code is returned from the startup function. --- src/responder/ifp/ifpsrv.c | 8 ++++++-- src/util/util_errors.c | 1 + src/util/util_errors.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c index 5dc5652b69e725881486dd9e85482e53ef3bb332..9014c3e8565d9f591e0805b2792c13c9ed6790ad 100644 --- a/src/responder/ifp/ifpsrv.c +++ b/src/responder/ifp/ifpsrv.c @@ -192,7 +192,7 @@ sysbus_init(TALLOC_CTX *mem_ctx, DEBUG(SSSDBG_CRIT_FAILURE, "Failed to connect to D-BUS system bus: [%s]\n", dbus_error.message); - ret = EIO; + ret = ERR_NO_SYSBUS; goto fail; } dbus_connection_set_exit_on_disconnect(conn, FALSE); @@ -372,7 +372,11 @@ int ifp_process_init(TALLOC_CTX *mem_ctx, INFOPIPE_IFACE, ifp_ifaces, ifp_ctx, &ifp_ctx->sysbus); - if (ret != EOK) { + if (ret == ERR_NO_SYSBUS) { + DEBUG(SSSDBG_MINOR_FAILURE, + "The system bus is not available..\n"); + /* Explicitly ignore, the D-Bus daemon will start us */ + } else if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Failed to connect to the system message bus\n"); talloc_free(ifp_ctx); diff --git a/src/util/util_errors.c b/src/util/util_errors.c index 113567423007cb39d3314ddfad9ba168fddb4f63..aa5693190ce9a73cd9d46a96d0c071e802a0dff2 100644 --- a/src/util/util_errors.c +++ b/src/util/util_errors.c @@ -60,6 +60,7 @@ struct err_string error_to_str[] = { { "Bus message has no sender" }, /* ERR_SBUS_NO_SENDER */ { "User/Group SIDs not found" }, /* ERR_NO_SIDS */ { "Bus method not supported" }, /* ERR_SBUS_NOSUP */ + { "Cannot connect to system bus" }, /* ERR_NO_SYSBUS */ }; diff --git a/src/util/util_errors.h b/src/util/util_errors.h index b88c7969bea90208ccb61cc1240b181cc0330774..f68409eedba0c6cf5d4883c35b59f68deb1d7a01 100644 --- a/src/util/util_errors.h +++ b/src/util/util_errors.h @@ -82,6 +82,7 @@ enum sssd_errors { ERR_SBUS_NO_SENDER, ERR_NO_SIDS, ERR_SBUS_NOSUP, + ERR_NO_SYSBUS, ERR_LAST /* ALWAYS LAST */ }; -- 1.9.3