[vlc-commits] vlclua_net_recv() : do like [b0d7c77b1] did for vlclua_fd_read()
Rafaël Carré
git at videolan.org
Sun Jun 19 18:22:09 CEST 2011
vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Sun Jun 19 12:15:42 2011 -0400| [f52a83cced1cbe43a448fd7f82e2ce7102f703c8] | committer: Rafaël Carré
vlclua_net_recv() : do like [b0d7c77b1] did for vlclua_fd_read()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f52a83cced1cbe43a448fd7f82e2ce7102f703c8
---
modules/lua/libs/net.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/modules/lua/libs/net.c b/modules/lua/libs/net.c
index e2b3c45..1c7cd12 100644
--- a/modules/lua/libs/net.c
+++ b/modules/lua/libs/net.c
@@ -190,7 +190,10 @@ static int vlclua_net_recv( lua_State *L )
size_t i_len = luaL_optint( L, 2, 1 );
char psz_buffer[i_len];
ssize_t i_ret = recv( i_fd, psz_buffer, i_len, 0 );
- lua_pushlstring( L, psz_buffer, (i_ret >= 0) ? i_ret : 0 );
+ if( i_ret > 0 )
+ lua_pushlstring( L, psz_buffer, i_ret );
+ else
+ lua_pushnil( L );
return 1;
}
More information about the vlc-commits
mailing list