summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b570e12)
As made obvious by commit
123f53f, the type of ssize_t cannot be trusted
on Windows to actually be signed, so don't use '< 0', as the compiler
will optimize the test away. POSIX also specifies only that -1 signals
an error condition, not any other negative value.
Luckily, comparing an unsigned int to -1 still works as intended.
ssize_t len = utcp_send(c, "Hello world!\n", 13);
if(len != 13) {
ssize_t len = utcp_send(c, "Hello world!\n", 13);
if(len != 13) {
fprintf(stderr, "Error: %s\n", strerror(errno));
else
fprintf(stderr, "Short write %zd!\n", len);
fprintf(stderr, "Error: %s\n", strerror(errno));
else
fprintf(stderr, "Short write %zd!\n", len);
len = utcp_send(c, "This is a test.\n", 16);
if(len != 16) {
len = utcp_send(c, "This is a test.\n", 16);
if(len != 16) {
fprintf(stderr, "Error: %s\n", strerror(errno));
else
fprintf(stderr, "Short write %zd!\n", len);
fprintf(stderr, "Error: %s\n", strerror(errno));
else
fprintf(stderr, "Short write %zd!\n", len);
return 1;
int s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
return 1;
int s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
dir &= ~1;
if(c)
utcp_shutdown(c, SHUT_WR);
dir &= ~1;
if(c)
utcp_shutdown(c, SHUT_WR);