Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soumyadipdm/1ea5cbc02e973aef4d17 to your computer and use it in GitHub Desktop.
Save soumyadipdm/1ea5cbc02e973aef4d17 to your computer and use it in GitHub Desktop.
diff --git a/libpromises/verify_classes.c b/libpromises/verify_classes.c
index cef489e..0cb79e6 100644
--- a/libpromises/verify_classes.c
+++ b/libpromises/verify_classes.c
@@ -161,8 +161,10 @@ static bool SelectClass(EvalContext *ctx, const Rlist *list, const Promise *pp)
assert(list);
char splay[CF_MAXVARSIZE];
+ uintmax_t now = (uintmax_t)time(NULL);
+ now -= now % CF_HASHTABLESIZE;
snprintf(splay, CF_MAXVARSIZE, "%s+%s+%ju",
- VFQNAME, VIPADDRESS, (uintmax_t)getuid());
+ VFQNAME, VIPADDRESS, now);
double hash = (double) StringHash(splay, 0, CF_HASHTABLESIZE);
assert(hash < CF_HASHTABLESIZE);
int n = (int) (count * hash / (double) CF_HASHTABLESIZE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment