diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-01-03 15:12:42 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-01-03 15:12:42 +0100 |
commit | bfa80a4e35f0a7e8268c2cdf83182510dae91323 (patch) | |
tree | 9dade151b5479fbbee5a2c048d2b5b89b2d3f459 /erts/etc/common/inet_gethost.c | |
parent | 0cf07c28d045351b7d72d0dfc4fc3b3aa14ea725 (diff) | |
download | otp-bfa80a4e35f0a7e8268c2cdf83182510dae91323.tar.gz otp-bfa80a4e35f0a7e8268c2cdf83182510dae91323.tar.bz2 otp-bfa80a4e35f0a7e8268c2cdf83182510dae91323.zip |
erts: Remove compiler warnings in inet_gethost.c
* Added a goto fail in worker loop if write() fails.
The 'fail' label used to be win32 only but is now
used across platforms.
Diffstat (limited to 'erts/etc/common/inet_gethost.c')
-rw-r--r-- | erts/etc/common/inet_gethost.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/erts/etc/common/inet_gethost.c b/erts/etc/common/inet_gethost.c index 2b9b84aa3b..d25d2910b4 100644 --- a/erts/etc/common/inet_gethost.c +++ b/erts/etc/common/inet_gethost.c @@ -1943,12 +1943,14 @@ static int worker_loop(void) } m = NULL; #else - write(1, reply, data_size); /* No signals expected */ + /* expect no signals */ + if (write(1, reply, data_size) < 0) + goto fail; #endif } /* for (;;) */ -#ifdef WIN32 fail: +#ifdef WIN32 if (m != NULL) { FREE(m); } @@ -1957,8 +1959,8 @@ static int worker_loop(void) if (reply) { FREE(reply); } - return 1; #endif + return 1; } static int map_netdb_error(int netdb_code) @@ -2559,7 +2561,8 @@ static void debugf(char *format, ...) WriteFile(debug_console_allocated,buff,strlen(buff),&res,NULL); } #else - write(2,buff,strlen(buff)); + /* suppress warning with 'if' */ + if(write(2,buff,strlen(buff))); #endif va_end(ap); } @@ -2581,7 +2584,8 @@ static void warning(char *format, ...) WriteFile(GetStdHandle(STD_ERROR_HANDLE),buff,strlen(buff),&res,NULL); } #else - write(2,buff,strlen(buff)); + /* suppress warning with 'if' */ + if(write(2,buff,strlen(buff))); #endif va_end(ap); } @@ -2603,7 +2607,8 @@ static void fatal(char *format, ...) WriteFile(GetStdHandle(STD_ERROR_HANDLE),buff,strlen(buff),&res,NULL); } #else - write(2,buff,strlen(buff)); + /* suppress warning with 'if' */ + if(write(2,buff,strlen(buff))); #endif va_end(ap); #ifndef WIN32 |