lib/logger: nonblocking waitpid to avoid sheep process cannot exit

Sometimes sheep process cannot exit as we expected. I think the
point might be the sequential problem by using waitpid, the
system call waiting for process to change state.

Current log_close function calling waitpid as a void method. It
will block the main process. Suppose this situation:

Father: --> active=false --------------------------------> waitpid
Child: -------------> active=true --> while(active) do sth. -->

The log process will loop forever so that the main process cannot
exit.

Therefore, it is better to retrieve the return value and pass the
nonblocking flag WNOHANG to it. Moreover, reset share memory flag
before each time calling waitpid.

Signed-off-by: Ruoyu <liangry@ucweb.com>
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>