lib/smbclient/Init: throw std::runtime_error on error
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "Init.hxx"
|
||||
#include "Mutex.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "system/Error.hxx"
|
||||
|
||||
#include <libsmbclient.h>
|
||||
|
||||
@@ -40,16 +40,12 @@ mpd_smbc_get_auth_data(gcc_unused const char *srv,
|
||||
strcpy(pw, "");
|
||||
}
|
||||
|
||||
bool
|
||||
SmbclientInit(Error &error)
|
||||
void
|
||||
SmbclientInit()
|
||||
{
|
||||
const ScopeLock protect(smbclient_mutex);
|
||||
|
||||
constexpr int debug = 0;
|
||||
if (smbc_init(mpd_smbc_get_auth_data, debug) < 0) {
|
||||
error.SetErrno("smbc_init() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (smbc_init(mpd_smbc_get_auth_data, debug) < 0)
|
||||
throw MakeErrno("smbc_init() failed");
|
||||
}
|
||||
|
@@ -20,14 +20,12 @@
|
||||
#ifndef MPD_SMBCLIENT_INIT_HXX
|
||||
#define MPD_SMBCLIENT_INIT_HXX
|
||||
|
||||
#include "check.h"
|
||||
|
||||
class Error;
|
||||
|
||||
/**
|
||||
* Initialize libsmbclient.
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
bool
|
||||
SmbclientInit(Error &error);
|
||||
void
|
||||
SmbclientInit();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user