diff options
author | Andy <andy.padavan@gmail.com> | 2014-03-17 19:50:29 +0000 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2014-03-17 19:50:29 +0000 |
commit | d5082158ee55db893aeafb0f8392ae6b5e2d1354 (patch) | |
tree | 2a70b9a55773369a2270c3c13f885c54646b9059 | |
parent | 3f7483e81684650102d8544ba1afd49be531bd54 (diff) | |
download | dnsmasq-d5082158ee55db893aeafb0f8392ae6b5e2d1354.tar.gz |
Ensure next_uid() can never return 0.
-rw-r--r-- | src/cache.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cache.c b/src/cache.c index a7be5f1..a3f9c3a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -74,13 +74,15 @@ static void cache_hash(struct crec *crecp); static unsigned int next_uid(void) { - static unsigned int uid = 1; + static unsigned int uid = 0; + uid++; + /* uid == 0 used to indicate CNAME to interface name. */ if (uid == 0) uid++; - return uid++; + return uid; } void cache_init(void) |