Adds the gcc attribute (if available) to client init functions to
ensure proper error handling.
Signed-off-by: Sam Lang <sam.lang@inktank.com>
}
}
-int Client::init()
+int Client::init()
{
client_lock.Lock();
assert(!initialized);
#include "common/Mutex.h"
#include "common/Timer.h"
+#include "common/compiler_extensions.h"
+
#include "osdc/ObjectCacher.h"
class MDSMap;
inodeno_t get_root_ino();
- int init();
+ int init() WARN_UNUSED_RESULT;
void shutdown();
// messaging
int SyntheticClient::run()
{
dout(15) << "initing" << dendl;
- client->init();
+ int err = client->init();
+ if (err < 0) {
+ char buf[80];
+ dout(0) << "failed to initialize: " << strerror_r(-err, buf, sizeof(buf)) << dendl;
+ return -1;
+ }
+
dout(15) << "mounting" << dendl;
- int err = client->mount("");
+ err = client->mount("");
if (err < 0) {
char buf[80];
dout(0) << "failed to mount: " << strerror_r(-err, buf, sizeof(buf)) << dendl;
// GCC
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
-// some other compiler
+// some other compiler - just make it a no-op
+#define WARN_UNUSED_RESULT
#endif
#endif