diff --git a/lib/path.c b/lib/path.c index 8c4df33b8..3a13af76b 100644 --- a/lib/path.c +++ b/lib/path.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -611,10 +612,13 @@ int path_stop(struct path *p) if (p->state != STATE_STOPPING) p->state = STATE_STOPPING; - /* Cancel the thread in case is currently in a blocking syscall */ + /* Cancel the thread in case is currently in a blocking syscall. + * + * We dont care if the thread has already been terminated. + */ ret = pthread_cancel(p->tid); - if (ret) - return ret; + if (ret && ret != ESRCH) + return ret; ret = pthread_join(p->tid, NULL); if (ret)