diff options
author | Max Kellermann <max@musicpd.org> | 2016-09-05 11:32:20 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-09-05 11:32:20 +0200 |
commit | 135662d6b0714d123afa805a62462fff917943b5 (patch) | |
tree | fc9209fec7c57693c771f4501a61dcca456c7063 /src/input | |
parent | a69c3c1848ec324975faa0dd14f0e7750c46bfee (diff) |
lib/smbclient/Init: throw std::runtime_error on error
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/plugins/SmbclientInputPlugin.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index 66c40957e..97be5c47a 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -28,6 +28,8 @@ #include <libsmbclient.h> +#include <stdexcept> + class SmbclientInputStream final : public InputStream { SMBCCTX *ctx; int fd; @@ -66,10 +68,13 @@ public: */ static InputPlugin::InitResult -input_smbclient_init(gcc_unused const ConfigBlock &block, Error &error) +input_smbclient_init(gcc_unused const ConfigBlock &block, gcc_unused Error &error) { - if (!SmbclientInit(error)) + try { + SmbclientInit(); + } catch (const std::runtime_error &e) { return InputPlugin::InitResult::UNAVAILABLE; + } // TODO: create one global SMBCCTX here? |