mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-30 12:50:58 +00:00
Fix memset in mg_iotest, add mg_random_str test
This commit is contained in:
1 parent
e30ad43d36
commit
6c796b8552
4 files changed
+19
-6
No files matched your search
+2
-2
@@ -522,7 +522,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
|
||||
nfds_t n = 0;
|
||||
for (struct mg_connection *c = mgr->conns; c != NULL; c = c->next) n++;
|
||||
struct pollfd *fds = (struct pollfd *) alloca(n * sizeof(fds[0]));
|
||||
if (n > 0) memset(fds, 0, sizeof(n * sizeof(fds[0])));
|
||||
memset(fds, 0, n * sizeof(fds[0]));
|
||||
n = 0;
|
||||
for (struct mg_connection *c = mgr->conns; c != NULL; c = c->next) {
|
||||
c->is_readable = c->is_writable = 0;
|
||||
@@ -544,7 +544,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
|
||||
#if MG_ARCH == MG_ARCH_WIN32
|
||||
if (n == 0) Sleep(ms); // On Windows, poll fails if no sockets
|
||||
#endif
|
||||
if (n > 0) memset(fds, 0, sizeof(n * sizeof(fds[0])));
|
||||
memset(fds, 0, n * sizeof(fds[0]));
|
||||
}
|
||||
n = 0;
|
||||
for (struct mg_connection *c = mgr->conns; c != NULL; c = c->next) {
|
||||
|
||||
Reference in new issue
Block a user