From 1b84b07f8cfc66721df45412c1346398cb4c5977 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 28 Sep 2024 22:53:02 +0300 Subject: [PATCH] fixed --- plainbin.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plainbin.c b/plainbin.c index dbaf793..3e2b28d 100644 --- a/plainbin.c +++ b/plainbin.c @@ -20,7 +20,7 @@ #define MSG4 "No namespace available.\n" #ifndef VERSION -#define VERSION "1.2.2" +#define VERSION "1.2.3" #endif typedef struct { @@ -102,6 +102,7 @@ NEW_SOCKET_ERROR: char rand_name(char *buf) { const char abc[] = "asdfghjklzxcvbnmqwertyuiopQWERTYUIOPASDFGHJKLZXCVBNM1234567890"; + srand(time(NULL)); for (int i = 0; i < 1000; i++) { for (size_t i = 0; i < cfg.name_len; i++) buf[i] = abc[rand() % (sizeof(abc) - 1)]; @@ -111,8 +112,6 @@ char rand_name(char *buf) { struct stat sb; if (stat(buf, &sb) < 0) return 0; - - return 1; } return 1; @@ -248,7 +247,6 @@ void Proc(int fd, int flag) { if (cfd < 0) continue; - printf("%d\n", clients); if (clients < cfg.max_clients) { clients++; @@ -294,8 +292,6 @@ void Proc(int fd, int flag) { } int main(int argc, char **argv) { - srand(time(NULL)); - signal(SIGUSR1, sig_handler); signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler);