fizwit / filesystem-reporting-tools

Tools to help system administors manage very large file systems. pwalk
GNU General Public License v2.0
22 stars 12 forks source link

An improper locking due to the unreleased lock mutexFD #22

Closed ryancaicse closed 1 year ago

ryancaicse commented 3 years ago

Hi developers, in the below codes, the lock mutexFD could be not released before program's exit exit(1); when slot == MAXTHRDS . I think there is no harm to write pthread_mutex_unlock (&mutexFD); before the exit(1); for better resource management and code symmetry. Thanks!

https://github.com/fizwit/filesystem-reporting-tools/blob/1df438e9345487b9c51d1eea3c93611e9198f173/pwalk.c#L214-L229

fizwit commented 3 years ago

thanks for your comments. I will review them. In all the years of running pwalk this exception has never been hit. When the process terminates would that not release the threads and locks?