httpclient: Added missing import
authorSteven Barth <steven@midlink.org>
Mon, 9 Mar 2009 20:06:36 +0000 (20:06 +0000)
committerSteven Barth <steven@midlink.org>
Mon, 9 Mar 2009 20:06:36 +0000 (20:06 +0000)
nixio: waitpid() returns 0 with WNOHANG and no terminated childs

libs/httpclient/luasrc/httpclient/receiver.lua
libs/nixio/src/process.c

index c12a673b369addb615e9bab1df9172aaf0599564..ad2ac8db7bdabdf9a61bc37d574d43d2d1c4a796 100644 (file)
@@ -17,7 +17,7 @@ local nixio = require "nixio"
 local httpc = require "luci.httpclient"
 local ltn12 = require "luci.ltn12"
 
-local print, tonumber, require = print, tonumber, require
+local print, tonumber, require, unpack = print, tonumber, require, unpack
 
 module "luci.httpclient.receiver"
 
index e8f0cdc50bf5e00eb8b06f85ecd282bc1dfc642c..69f19b7ac1bf4f104a729e608b39ca9aa6d3e010 100644 (file)
@@ -59,7 +59,10 @@ static int nixio_wait(lua_State *L) {
                pidout = waitpid(pidin, &status, options);
        } while (pidout == -1 && errno == EINTR);
 
-       if (pidout == -1) {
+       if (pidout == 0) {
+               lua_pushboolean(L, 0);
+               return 1;
+       } else if (pidout == -1) {
                return nixio__perror(L);
        } else {
                lua_pushinteger(L, pidout);