mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
df: unlock retire_mutex on early exit
If pthread_cond_wait fails and the thread worker ends, make sure to unlock retire_mutex, which has been locked for the condition. The return value of pthread_mutex_unlock is ignored, as there's nothing that can be done with it at that point.
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include <libvirt/virterror.h>
|
||||
#endif
|
||||
|
||||
#include "ignore-value.h"
|
||||
|
||||
#include "guestfs.h"
|
||||
#include "guestfs-internal-frontend.h"
|
||||
#include "options.h"
|
||||
@@ -224,6 +226,7 @@ worker_thread (void *thread_data_vp)
|
||||
if (err != 0) {
|
||||
thread_failure ("pthread_cond_wait", err);
|
||||
thread_data->r = -1;
|
||||
ignore_value (pthread_mutex_unlock (&retire_mutex));
|
||||
return &thread_data->r;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user