[PATCH] wrc: check return of fstat (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Nov 14 03:40:14 CST 2011


Hi,

check return value of fstat() like we do in 34 of 42 cases throughout wine.
CID 5446

Ciao, Marcus
---
 tools/wrc/po.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/wrc/po.c b/tools/wrc/po.c
index 1882d78..fccb941 100644
--- a/tools/wrc/po.c
+++ b/tools/wrc/po.c
@@ -884,7 +884,7 @@ static void load_mo_file( const char *name )
 
     fd = open( name, O_RDONLY | O_BINARY );
     if (fd == -1) fatal_perror( "Failed to open %s", name );
-    fstat( fd, &st );
+    if (-1 == fstat( fd, &st )) fatal_perror( "Failed to fstat %s", name );
     mo_file = xmalloc( st.st_size );
     res = read( fd, mo_file, st.st_size );
     if (res == -1) fatal_perror( "Failed to read %s", name );
-- 
1.7.3.4




More information about the wine-patches mailing list