diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-08 12:53:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-08 12:53:49 -0300 |
commit | 0c78de0d6df13269458d38199f0a8bbe7ce733f2 (patch) | |
tree | 1cf02646d2363d1136e99ce50e1e97ce8a45b563 /ldump.c | |
parent | df45f7118bb1c849bca789cbeaaa5a2268b2c601 (diff) | |
download | lua-0c78de0d6df13269458d38199f0a8bbe7ce733f2.tar.gz lua-0c78de0d6df13269458d38199f0a8bbe7ce733f2.tar.bz2 lua-0c78de0d6df13269458d38199f0a8bbe7ce733f2.zip |
avoid calling write function with empty block
Diffstat (limited to 'ldump.c')
-rw-r--r-- | ldump.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldump.c,v 2.35 2015/01/16 16:54:37 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.36 2015/03/30 15:43:51 roberto Exp roberto $ |
3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -38,7 +38,7 @@ typedef struct { | |||
38 | 38 | ||
39 | 39 | ||
40 | static void DumpBlock (const void *b, size_t size, DumpState *D) { | 40 | static void DumpBlock (const void *b, size_t size, DumpState *D) { |
41 | if (D->status == 0) { | 41 | if (D->status == 0 && size > 0) { |
42 | lua_unlock(D->L); | 42 | lua_unlock(D->L); |
43 | D->status = (*D->writer)(D->L, b, size, D->data); | 43 | D->status = (*D->writer)(D->L, b, size, D->data); |
44 | lua_lock(D->L); | 44 | lua_lock(D->L); |