Permalink
Browse files

[fix] properly check for channel fd, default to 1

  • Loading branch information...
1 parent 7186e33 commit 10c937cb018e07c4d0bf26dd3be87cf5c8ebc48f @bmeck committed Mar 19, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 fixtures/nix.c
View
8 fixtures/nix.c
@@ -16,7 +16,13 @@ __attribute__((constructor))
static void __interposed_init()
{
char* env_channel_fd = getenv("NODE_CHANNEL_FD");
- sscanf(env_channel_fd,"%d", &__interposed_CHANNEL_FD);
+ int found = 0;
+ if (env_channel_fd) {
+ found = sscanf(env_channel_fd,"%d", &__interposed_CHANNEL_FD);
+ }
+ if (!found) {
+ __interposed_CHANNEL_FD = 1;
+ }
}
#define RTLD_SEND(params, ret) __interposed_RTLD_SEND(__FUNCTION__, params, ret)

0 comments on commit 10c937c

Please sign in to comment.