From ebe5c33cd626dfc9a09e608707f1db5cab8a84f1 Mon Sep 17 00:00:00 2001 From: solusipse Date: Fri, 6 Sep 2013 05:03:11 +0200 Subject: [PATCH] fixed time seed issue --- fiche.c | 4 ++-- fiche.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fiche.c b/fiche.c index 23758da..687a34c 100755 --- a/fiche.c +++ b/fiche.c @@ -27,7 +27,7 @@ $ cat fiche.c | nc localhost 9999 int main(int argc, char **argv) { - srand((unsigned int) time(0)); + time_seed = time(0); set_basedir(); parse_parameters(argc, argv); @@ -156,7 +156,7 @@ void bind_to_port(int listen_socket, struct sockaddr_in server_address) void generate_url(char *buffer, char *slug) { - int i, time_seed = time(0); + int i; memset(slug, '\0', sizeof(slug)); for (i = 0; i <= SLUG_SIZE - 1; i++) diff --git a/fiche.h b/fiche.h index 15613f4..45f65d3 100644 --- a/fiche.h +++ b/fiche.h @@ -39,6 +39,7 @@ $ cat fiche.c | nc localhost 9999 #include #include +int time_seed; char *BASEDIR; int PORT = 9999; int SLUG_SIZE = 4;