From: Jens Axboe Date: Tue, 9 Jun 2009 11:05:32 +0000 (+0200) Subject: Fix fd leak in cache line checking X-Git-Tag: fio-1.27.2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=ec76f15a4ae995c06db6c6dda6a6fa41b189f613;p=fio.git Fix fd leak in cache line checking Signed-off-by: Jens Axboe --- diff --git a/os/os-linux.h b/os/os-linux.h index 1cd8272d..b766cbf9 100644 --- a/os/os-linux.h +++ b/os/os-linux.h @@ -263,10 +263,13 @@ static inline int arch_cache_line_size(void) return -1; ret = read(fd, size, sizeof(size)); + + close(fd); + if (ret <= 0) return -1; - - return atoi(size); + else + return atoi(size); } #endif