+ }
+
+ /* redirect stdout and stderr */
+ if (redirectFD() < 0) {
+ return -1;
+ }
+
+ /* spawn the logging thread */
+ if (pthread_create(&__loggingThread, 0, stdlog, 0) != 0) {
+ _ERR("fail to create pthread");
+ return -1;
+ }
+
+ if (pthread_detach(__loggingThread) != 0) {
+ _ERR("fail to detach pthread");
+ return -1;
+ }