From 214091e490a4b76cecbc28521a2ed117e2ec5af1 Mon Sep 17 00:00:00 2001 From: Peter Haag Date: Sun, 24 Jun 2018 11:12:31 +0200 Subject: [PATCH] Fix bookkeeper type - use key_t --- ChangeLog | 3 +++ bin/bookkeeper.c | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cad149..152f584 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-06-24 +- Fix bookkeeper type - use key_t + 2018-05-06 - New bookkeeper hash broke NfSen. Fixed. ported back to release 1.6.17 diff --git a/bin/bookkeeper.c b/bin/bookkeeper.c index 44fd5f1..942cc96 100644 --- a/bin/bookkeeper.c +++ b/bin/bookkeeper.c @@ -69,7 +69,7 @@ static bookkeeper_list_t *bookkeeper_list = NULL; /* function prototypes */ -static uint32_t hash(char *str, int flag); +static key_t hash(char *str, int flag); static void sem_lock(int sem_set_id); @@ -81,13 +81,13 @@ static inline bookkeeper_list_t *Get_bookkeeper_list_entry(bookkeeper_t *bookkee /* hash: compute hash value of string */ #define MULTIPLIER 37 -static uint32_t hash(char *str, int flag) { +static key_t hash(char *str, int flag) { uint32_t h; unsigned char *p; char cleanPath[MAXPATHLEN]; if ( realpath(str, cleanPath) == NULL ) { - return 0; + return -1; } h = 0; @@ -97,7 +97,8 @@ char cleanPath[MAXPATHLEN]; if ( flag ) { h = MULTIPLIER * h + 'R'; } - return h; // or, h % ARRAY_SIZE; + // LogError("Bookeeper hash for path: '%s' -> '%s': %u flag: %i", str, cleanPath, h, flag); + return (key_t)h; // or, h % ARRAY_SIZE; } // End of hash