- More error checking.

master
Asim Jamshed 2017-03-05 17:17:20 +09:00
parent 14c4652e18
commit 768982248a
3 changed files with 8 additions and 7 deletions

View File

@ -734,6 +734,9 @@ main(int argc, char **argv)
TRACE_CONFIG("CPU limit should be smaller than the " TRACE_CONFIG("CPU limit should be smaller than the "
"number of CPUS: %d\n", num_cores); "number of CPUS: %d\n", num_cores);
return FALSE; return FALSE;
} else if (core_limit < 1) {
TRACE_CONFIG("CPU limit should be greater than 0\n");
return FALSE;
} }
/** /**
* it is important that core limit is set * it is important that core limit is set

View File

@ -395,7 +395,7 @@ mtcp_socket(mctx_t mctx, int domain, int type, int protocol)
} }
if (type == SOCK_STREAM) { if (type == SOCK_STREAM) {
type = MTCP_SOCK_STREAM; type = (int)MTCP_SOCK_STREAM;
} else { } else {
errno = EINVAL; errno = EINVAL;
return -1; return -1;

View File

@ -106,12 +106,10 @@ http_header_str_val(const char* buf, const char *key, const int keylen,
} }
/* copy value data */ /* copy value data */
if (temp) { while (*temp && !CR_OR_NEWLINE(*temp) && i < value_len-1)
while (*temp && !CR_OR_NEWLINE(*temp) && i < value_len-1) value[i++] = *temp++;
value[i++] = *temp++; value[i] = 0;
value[i] = 0;
}
if (i == 0) { if (i == 0) {
*value = 0; *value = 0;
return NULL; return NULL;