Fix some coverity warnings
Fix more coverity warnings
Try to fix a coverity false positive
Two fixes for coverity false-positives
Fix build
Fix a possible stat-open race condition
Fix a win32 warning
Don't double-close fd