Diff

util-src/pposix.c @ 6647:0c363fddcdd9

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 03 May 2015 18:39:27 +0200
parent 6642:113d321976b6
child 6789:6b180e77c97a
line wrap: on
line diff
--- a/util-src/pposix.c	Mon Apr 27 00:03:14 2015 +0200
+++ b/util-src/pposix.c	Sun May 03 18:39:27 2015 +0200
@@ -750,7 +750,10 @@
 		lua_pushstring(L, strerror(ret));
 		/* posix_fallocate() can leave a bunch of NULs at the end, so we cut that
 		 * this assumes that offset == length of the file */
-		ftruncate(fileno(f), offset);
+		if(ftruncate(fileno(f), offset) != 0) {
+			lua_pushstring(L, strerror(errno));
+			return 3;
+		}
 		return 2;
 	}
 }