If the poll client is stopped (killed) the server will crash due to
SIGPIPE. Fix this by intercepting SIGPIPE and clearing the client file
to avoid further prints to it.
Change-Id: I588b9c098634e2eb5cec9dd003e4f9a3be188c3f
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
#include <dlfcn.h>
#include <pthread.h>
#include <errno.h>
+#include <signal.h>
#include <hardware/sensors.h>
#include <utils/Log.h>
}
}
+static void sig_pipe(int sig)
+{
+ client = NULL;
+}
+
static void *run_sensors_thread(void *arg __attribute((unused)))
{
+
+ signal(SIGPIPE, sig_pipe);
+
switch (dev->version) {
case SENSORS_DEVICE_API_VERSION_0_1:
default:
fclose(f);
}
-
close(conn);
}
}