Skip to content

Commit

Permalink
lua-ev: Fix is_deamon behavior
Browse files Browse the repository at this point in the history
This fixes an error wherein calling loop_start_watcher with is_daemon ==
-1 would result in a daemonized watcher if it was previously unregistered,
instead of a non-daemonized watcher as documented in the comment (and
makes sense).
  • Loading branch information
bdowning authored and Brian Maher committed Oct 7, 2010
1 parent 2bdc4c1 commit 56ed37d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions loop_lua_ev.c
Expand Up @@ -144,6 +144,14 @@ static void loop_start_watcher(lua_State* L, int loop_i, int watcher_i, int is_d
} }
lua_pop(L, 1); lua_pop(L, 1);


if ( is_daemon == -1 ) {
/* Set is_daemon properly for -1 case. */
if ( current_is_daemon == -1 )
is_daemon = 0;
else
is_daemon = current_is_daemon;
}

/* Currently not initialized, or daemon status change? */ /* Currently not initialized, or daemon status change? */
if ( -1 == current_is_daemon || if ( -1 == current_is_daemon ||
current_is_daemon ^ is_daemon ) current_is_daemon ^ is_daemon )
Expand Down

0 comments on commit 56ed37d

Please sign in to comment.