Private
Public Access
2
0

mraa.c: check already initialised before anything else in mraa_init

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-12-09 18:31:20 +00:00
parent bd16eccad1
commit e9297d8283

View File

@@ -57,6 +57,10 @@ mraa_set_log_level(int level)
mraa_result_t __attribute__((constructor))
mraa_init()
{
if (plat != NULL) {
return MRAA_ERROR_PLATFORM_ALREADY_INITIALISED;
}
#ifdef DEBUG
setlogmask(LOG_UPTO(LOG_DEBUG));
#else
@@ -66,9 +70,6 @@ mraa_init()
openlog("libmraa", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
syslog(LOG_DEBUG, "libmraa initialised by user %d", getuid());
if (plat != NULL) {
return MRAA_ERROR_PLATFORM_ALREADY_INITIALISED;
}
#ifdef SWIGPYTHON
// Initialise python threads, this allows use to grab the GIL when we are
// required to do so