This commit is contained in:
Your Name 2024-07-01 10:26:22 +03:00
parent f207924062
commit 83063037ac

View File

@ -20,7 +20,7 @@
#define MSG4 "No namespace available.\n" #define MSG4 "No namespace available.\n"
#ifndef VERSION #ifndef VERSION
#define VERSION "1" #define VERSION "1.1"
#endif #endif
int iport = 8080; int iport = 8080;
@ -99,7 +99,7 @@ char *rand_string(void) {
} }
char *rand_name(void) { char *rand_name(void) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 1000; i++) {
char *filename = rand_string(); char *filename = rand_string();
if (filename == NULL) if (filename == NULL)
continue; continue;
@ -186,15 +186,17 @@ void upload(int cfd, pid_t par) {
/* Clear */ /* Clear */
UPL_ERROR: UPL_ERROR:
if (buf != NULL) if (buf)
free(buf); free(buf);
if (ffd != -1) if (ffd != -1)
close(ffd); close(ffd);
if (ret == -1) if (ret == -1)
fprintf(stderr, "%s: input thread: %s: %s\n", prog_name, filename, strerror(errno)); fprintf(stderr, "%s: input thread: %s: %s\n", prog_name, (filename) ? filename : "NULL", strerror(errno));
free(filename);
if (filename)
free(filename);
close(cfd); close(cfd);
kill(par, SIGUSR1); kill(par, SIGUSR1);
@ -267,15 +269,17 @@ void load(int cfd, pid_t par) {
/* Clear */ /* Clear */
LD_ERROR: LD_ERROR:
if (buf != NULL) if (buf)
free(buf); free(buf);
if (ffd != -1) if (ffd != -1)
close(ffd); close(ffd);
if (ret == -1) if (ret == -1)
fprintf(stderr, "%s: output thread: %s: %s\n", prog_name, filename, strerror(errno)); fprintf(stderr, "%s: output thread: %s: %s\n", prog_name, (filename) ? filename : "NULL", strerror(errno));
free(filename);
if (filename)
free(filename);
sleep(1); sleep(1);
close(cfd); close(cfd);