[vhffs-dev] [1315] check the return of fstat() (well it should never fail, but...)

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1315
Author:   gradator
Date:     2008-12-08 09:14:26 +0100 (Mon, 08 Dec 2008)

Log Message:
-----------
check the return of fstat() (well it should never fail, but...)

Modified Paths:
--------------
    trunk/vhffs-fssync/vhffsfssync_master.c


Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c	2008-12-07 01:08:34 UTC (rev 1314)
+++ trunk/vhffs-fssync/vhffsfssync_master.c	2008-12-08 08:14:26 UTC (rev 1315)
@@ -465,8 +465,12 @@
 	if(file) {
 		file->ref++;
 		// update size of file (it might have changed)
-		fstat(fileno(file->file_stream), &st);
-		file->file_size = st.st_size;
+		if( fstat(fileno(file->file_stream), &st) < 0 )  {
+			fprintf(stderr, "fstat() failed on %s: %s\n", pathname, strerror(errno));
+		}
+		else {
+			file->file_size = st.st_size;
+		}
 		return file;
 	}
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/