Remove useless range check.

This commit is contained in:
Roy Marples 2016-05-03 14:17:37 +00:00
parent f137e29cb6
commit 9d3a9d1320
3 changed files with 9 additions and 5 deletions

View File

@ -1455,6 +1455,12 @@ main(int argc, char **argv)
const char *siga = NULL;
#endif
int seq;
seq = INT_MAX;
printf ("%d\n", seq);
seq++;
printf ("%u\n", (uint32_t)seq);
/* Test for --help and --version */
if (argc > 1) {
if (strcmp(argv[1], "--help") == 0) {

View File

@ -122,8 +122,8 @@ struct dhcpcd_ctx {
#endif
void *priv;
int link_fd;
unsigned int seq; /* route message sequence no */
unsigned int sseq; /* successful seq no sent */
int seq; /* route message sequence no */
int sseq; /* successful seq no sent */
#ifdef USE_SIGNALS
sigset_t sigset;

View File

@ -925,9 +925,7 @@ send_netlink(struct dhcpcd_ctx *ctx, struct interface *ifp,
msg.msg_iovlen = 1;
/* Request a reply */
hdr->nlmsg_flags |= NLM_F_ACK;
if (++ctx->seq > UINT32_MAX)
ctx->seq = 0;
hdr->nlmsg_seq = (uint32_t)ctx->seq;
hdr->nlmsg_seq = (uint32_t)++ctx->seq;
if (sendmsg(s, &msg, 0) != -1) {
ctx->sseq = ctx->seq;
r = get_netlink(ctx, ifp, s, 0, callback);