fixed
This commit is contained in:
parent
e409d6e7eb
commit
1b84b07f8c
@ -20,7 +20,7 @@
|
|||||||
#define MSG4 "No namespace available.\n"
|
#define MSG4 "No namespace available.\n"
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "1.2.2"
|
#define VERSION "1.2.3"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -102,6 +102,7 @@ NEW_SOCKET_ERROR:
|
|||||||
char rand_name(char *buf) {
|
char rand_name(char *buf) {
|
||||||
const char abc[] = "asdfghjklzxcvbnmqwertyuiopQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
|
const char abc[] = "asdfghjklzxcvbnmqwertyuiopQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
for (size_t i = 0; i < cfg.name_len; i++)
|
for (size_t i = 0; i < cfg.name_len; i++)
|
||||||
buf[i] = abc[rand() % (sizeof(abc) - 1)];
|
buf[i] = abc[rand() % (sizeof(abc) - 1)];
|
||||||
@ -111,8 +112,6 @@ char rand_name(char *buf) {
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (stat(buf, &sb) < 0)
|
if (stat(buf, &sb) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -248,7 +247,6 @@ void Proc(int fd, int flag) {
|
|||||||
if (cfd < 0)
|
if (cfd < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf("%d\n", clients);
|
|
||||||
if (clients < cfg.max_clients) {
|
if (clients < cfg.max_clients) {
|
||||||
clients++;
|
clients++;
|
||||||
|
|
||||||
@ -294,8 +292,6 @@ void Proc(int fd, int flag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
srand(time(NULL));
|
|
||||||
|
|
||||||
signal(SIGUSR1, sig_handler);
|
signal(SIGUSR1, sig_handler);
|
||||||
signal(SIGINT, sig_handler);
|
signal(SIGINT, sig_handler);
|
||||||
signal(SIGTERM, sig_handler);
|
signal(SIGTERM, sig_handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user