Skip to content

Commit

Permalink
Ignore SIGPIPE to prevent program termination
Browse files Browse the repository at this point in the history
Fixes #60
  • Loading branch information
vareddy committed Jan 23, 2018
1 parent bf20603 commit 64f9dd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions network/OpenSSL/OpenSSLConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ namespace awsiotsdk {
ERR_load_BIO_strings();
ERR_load_crypto_strings();
SSL_load_error_strings();
signal(SIGPIPE, SIG_IGN);
is_lib_initialized = true;
}
const SSL_METHOD *method;
Expand Down

2 comments on commit 64f9dd8

@entitycs
Copy link

@entitycs entitycs commented on 64f9dd8 Feb 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in an error in my Visual Studio build.

Error C2065 'SIGPIPE': undeclared identifier pub-sub-sample C:\AWS\aws-iot-device-sdk-cpp-master\network\OpenSSL\OpenSSLConnection.cpp 157

How can I get past this?

I went ahead and wrapped a #define SIGPIPE 13 in an #ifndef block for my Windows app hoping that is enough.

Thanks,

@vareddy-zz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @entitycs ,
Sorry for the delayed reply, we don't have tracking for comments made to commits.
SIGPIPE does not exist on Windows, hence wrapping the ignore call inside a #ifndef block should fix the issue.
I will update the master code with the above fix. Thanks for the catch!
Varun

Please sign in to comment.