svn commit: r265623 - user/marcel/mkimg

Marcel Moolenaar marcel at FreeBSD.org
Thu May 8 00:08:19 UTC 2014


Author: marcel
Date: Thu May  8 00:08:19 2014
New Revision: 265623
URL: http://svnweb.freebsd.org/changeset/base/265623

Log:
  When write sparse files, make sure to truncate(2) the file. Otherwise
  any hole at the end is lost and the file is not of the right size.

Modified:
  user/marcel/mkimg/image.c

Modified: user/marcel/mkimg/image.c
==============================================================================
--- user/marcel/mkimg/image.c	Wed May  7 23:50:44 2014	(r265622)
+++ user/marcel/mkimg/image.c	Thu May  8 00:08:19 2014	(r265623)
@@ -118,6 +118,8 @@ image_copyout(int fd)
 		}
 	}
 	free(buffer);
+	ofs = lseek(fd, 0L, SEEK_CUR);
+	ftruncate(fd, ofs);
 	return (error);
 }
 


More information about the svn-src-user mailing list