lib:replace: Add getprogname()
[samba.git] / lib / pthreadpool / pthreadpool_tevent.c
index 19b1e6d9650a467a1b933dafba71b7064efeac63..12148f18123b59eb273eed3fad62ca0807bd9f73 100644 (file)
@@ -20,6 +20,7 @@
 #include "replace.h"
 #include "system/select.h"
 #include "system/threads.h"
+#include "system/filesys.h"
 #include "pthreadpool_tevent.h"
 #include "pthreadpool.h"
 #include "lib/util/tevent_unix.h"
@@ -718,6 +719,7 @@ static int pthreadpool_tevent_register_ev(
                        return ENOMEM;
                }
                tevent_fd_set_auto_close(glue->fde);
+               monitor_fd = -1;
        }
 
        /*
@@ -872,7 +874,7 @@ static void pthreadpool_tevent_job_orphan(struct pthreadpool_tevent_job *job)
         */
        PTHREAD_TEVENT_JOB_THREAD_FENCE(job);
        while (job->needs_fence.wrapper) {
-               poll(NULL, 0, 1);
+               (void)poll(NULL, 0, 1);
                PTHREAD_TEVENT_JOB_THREAD_FENCE(job);
        }
        job->wrapper = NULL;
@@ -902,7 +904,7 @@ static void pthreadpool_tevent_job_orphan(struct pthreadpool_tevent_job *job)
                if (job->needs_fence.signaled) {
                        break;
                }
-               poll(NULL, 0, 1);
+               (void)poll(NULL, 0, 1);
                PTHREAD_TEVENT_JOB_THREAD_FENCE(job);
        }
 
@@ -991,6 +993,7 @@ struct tevent_req *pthreadpool_tevent_job_send(
        struct pthreadpool_tevent_job_state *state = NULL;
        struct pthreadpool_tevent_job *job = NULL;
        int ret;
+       struct pthreadpool_tevent *caller_pool = pool;
        struct pthreadpool_tevent_wrapper *wrapper = pool->wrapper.ctx;
 
        pthreadpool_tevent_cleanup_orphaned_jobs();
@@ -1036,7 +1039,7 @@ struct tevent_req *pthreadpool_tevent_job_send(
                return tevent_req_post(req, ev);
        }
        PTHREAD_TEVENT_JOB_THREAD_FENCE_INIT(job);
-       job->per_thread_cwd = pthreadpool_tevent_per_thread_cwd(pool);
+       job->per_thread_cwd = pthreadpool_tevent_per_thread_cwd(caller_pool);
        talloc_set_destructor(job, pthreadpool_tevent_job_destructor);
        DLIST_ADD_END(job->pool->jobs, job);
        job->state = state;