Message ID | 20140401164104.GH16484@spoyarek.pnq.redhat.com |
---|---|
State | New |
Headers | show |
If you bzero before explicitly filling fields, does the compiler optimize to only zeroing the one unused field? If so, that seems more futureproof.
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index c069bf6..663fcc5 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -243,6 +243,8 @@ datahead_init_common (struct datahead *head, nscd_ssize_t allocsize, head->allocsize = allocsize; head->recsize = recsize; head->usable = true; + /* Initialize so that we don't write out a junk byte to the cache. */ + head->unused = 0; head->ttl = ttl; /* Compute the timeout time. */