Software / code / prosody
Comparison
util-src/pposix.c @ 6642:113d321976b6
util.pposix: Return error from ftruncate if that fails too (but what would we do here?)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 02 May 2015 14:41:56 +0200 |
| parent | 6620:50eaefeec013 |
| child | 6789:6b180e77c97a |
comparison
equal
deleted
inserted
replaced
| 6641:b44ebfe81c73 | 6642:113d321976b6 |
|---|---|
| 748 } else { | 748 } else { |
| 749 lua_pushnil(L); | 749 lua_pushnil(L); |
| 750 lua_pushstring(L, strerror(ret)); | 750 lua_pushstring(L, strerror(ret)); |
| 751 /* posix_fallocate() can leave a bunch of NULs at the end, so we cut that | 751 /* posix_fallocate() can leave a bunch of NULs at the end, so we cut that |
| 752 * this assumes that offset == length of the file */ | 752 * this assumes that offset == length of the file */ |
| 753 ftruncate(fileno(f), offset); | 753 if(ftruncate(fileno(f), offset) != 0) { |
| 754 lua_pushstring(L, strerror(errno)); | |
| 755 return 3; | |
| 756 } | |
| 754 return 2; | 757 return 2; |
| 755 } | 758 } |
| 756 } | 759 } |
| 757 #endif | 760 #endif |
| 758 | 761 |