diff options
author | Kim Alvefur <zash@zash.se> | 2015-05-03 18:39:27 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-05-03 18:39:27 +0200 |
commit | 8896368c298dc1d009dc56b38919e02b35f3214d (patch) | |
tree | 1db58cd52f622c3560457cf589cdc8e6326d28e6 /util-src | |
parent | ec503579285d613085de37168feffa3ad9ea793d (diff) | |
parent | f303d3dda826ebe6df8bc8a4534ee674291a4795 (diff) | |
download | prosody-8896368c298dc1d009dc56b38919e02b35f3214d.tar.gz prosody-8896368c298dc1d009dc56b38919e02b35f3214d.zip |
Merge 0.10->trunk
Diffstat (limited to 'util-src')
-rw-r--r-- | util-src/encodings.c | 5 | ||||
-rw-r--r-- | util-src/pposix.c | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c index 2eaad2c8..c00b2267 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -476,14 +476,15 @@ static int Lidna_to_unicode(lua_State* L) { /** idna.to_unicode(s) */ static int Lidna_to_ascii(lua_State* L) { /** idna.to_ascii(s) */ size_t len; const char* s = check_utf8(L, 1, &len); + char* output = NULL; + int ret; if(s == NULL || len != strlen(s)) { lua_pushnil(L); return 1; /* TODO return error message */ } - char* output = NULL; - int ret = idna_to_ascii_8z(s, &output, IDNA_USE_STD3_ASCII_RULES); + ret = idna_to_ascii_8z(s, &output, IDNA_USE_STD3_ASCII_RULES); if(ret == IDNA_SUCCESS) { lua_pushstring(L, output); diff --git a/util-src/pposix.c b/util-src/pposix.c index d797f032..5288b08c 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -750,7 +750,10 @@ int lc_fallocate(lua_State* L) { 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; } } |