Skip to content

Commit

Permalink
win: Redefine NSIG to consider SIGWINCH
Browse files Browse the repository at this point in the history
Since SIGWINCH is being defined with a value above the existing NSIG,
redefine NSIG on WIN32.

PR-URL: libuv#2032
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
  • Loading branch information
jstuder-gh authored and santigimeno committed Oct 18, 2018
1 parent d0b1584 commit 20f2351
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/uv/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ typedef struct pollfd {
#define SIGKILL 9
#define SIGWINCH 28

/* Redefine NSIG to take SIGWINCH into consideration */
#if defined(NSIG) && NSIG <= SIGWINCH
# undef NSIG
#endif
#ifndef NSIG
# define NSIG SIGWINCH + 1
#endif

/* The CRT defines SIGABRT_COMPAT as 6, which equals SIGABRT on many unix-like
* platforms. However MinGW doesn't define it, so we do. */
#ifndef SIGABRT_COMPAT
Expand Down
2 changes: 1 addition & 1 deletion src/win/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ int uv__signal_start(uv_signal_t* handle,
int signum,
int oneshot) {
/* Test for invalid signal values. */
if (signum != SIGWINCH && (signum <= 0 || signum >= NSIG))
if (signum <= 0 || signum >= NSIG)
return UV_EINVAL;

/* Short circuit: if the signal watcher is already watching {signum} don't go
Expand Down

0 comments on commit 20f2351

Please sign in to comment.