Skip to content

Commit

Permalink
Use consistent types for overflow comparison
Browse files Browse the repository at this point in the history
Unsigned long might not be 32-bits, in which case the overflow check
fails for a 32-bit kdb_sno_t.  Cast from -1 explicitly as a more
robust check.
  • Loading branch information
kaduk committed Jul 3, 2012
1 parent f594782 commit e7aa25d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/kdb/kdb_log.c
Expand Up @@ -204,7 +204,7 @@ ulog_add_update(krb5_context context, kdb_incr_update_t *upd)
* We need to overflow our sno, replicas will do full
* resyncs once they see their sno > than the masters.
*/
if (cur_sno == ULONG_MAX)
if (cur_sno == (kdb_sno_t)-1)
cur_sno = 1;
else
cur_sno++;
Expand Down

0 comments on commit e7aa25d

Please sign in to comment.