svn commit: r310566 - stable/10/contrib/bsnmp/lib
Ngie Cooper
ngie at FreeBSD.org
Mon Dec 26 06:09:10 UTC 2016
Author: ngie
Date: Mon Dec 26 06:09:09 2016
New Revision: 310566
URL: https://svnweb.freebsd.org/changeset/base/310566
Log:
MFstable/11 r310565:
MFC r310202:
Clean up trailing and leading whitespace
Fix variable type alignment in snmp_dialog(..)
Modified:
stable/10/contrib/bsnmp/lib/snmpclient.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/contrib/bsnmp/lib/snmpclient.c
==============================================================================
--- stable/10/contrib/bsnmp/lib/snmpclient.c Mon Dec 26 06:08:20 2016 (r310565)
+++ stable/10/contrib/bsnmp/lib/snmpclient.c Mon Dec 26 06:09:09 2016 (r310566)
@@ -8,7 +8,7 @@
*
* Author: Harti Brandt <harti at freebsd.org>
* Kendy Kutzner
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -17,7 +17,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -1236,23 +1236,23 @@ snmp_send_packet(struct snmp_pdu * pdu)
return (-1);
}
- pdu->request_id = snmp_next_reqid(&snmp_client);
+ pdu->request_id = snmp_next_reqid(&snmp_client);
- b.asn_ptr = buf;
- b.asn_len = snmp_client.txbuflen;
- if (snmp_pdu_encode(pdu, &b)) {
+ b.asn_ptr = buf;
+ b.asn_len = snmp_client.txbuflen;
+ if (snmp_pdu_encode(pdu, &b)) {
seterr(&snmp_client, "%s", strerror(errno));
free(buf);
return (-1);
}
- if (snmp_client.dump_pdus)
- snmp_pdu_dump(pdu);
+ if (snmp_client.dump_pdus)
+ snmp_pdu_dump(pdu);
- if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) {
+ if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) {
seterr(&snmp_client, "%s", strerror(errno));
free(buf);
- return (-1);
+ return (-1);
}
free(buf);
@@ -1269,7 +1269,7 @@ snmp_timeout(void * listentry_ptr)
#if 0
warnx("snmp request %i timed out, attempt (%i/%i)",
- listentry->reqid, listentry->retrycount, snmp_client.retries);
+ listentry->reqid, listentry->retrycount, snmp_client.retries);
#endif
listentry->retrycount++;
@@ -1314,7 +1314,7 @@ snmp_pdu_send(struct snmp_pdu *pdu, snmp
listentry->callback = func;
listentry->arg = arg;
listentry->retrycount=1;
- listentry->timeout_id =
+ listentry->timeout_id =
snmp_client.timeout_start(&snmp_client.timeout, snmp_timeout,
listentry);
@@ -1463,7 +1463,7 @@ snmp_receive_packet(struct snmp_pdu *pdu
return (+1);
}
-static int
+static int
snmp_deliver_packet(struct snmp_pdu * resp)
{
struct sent_pdu *listentry;
@@ -1548,7 +1548,7 @@ ok_getnext(const struct snmp_pdu * req,
&resp->bindings[i].var)) {
if (i != 0)
warnx("SNMP GETNEXT: inconsistent table "
- "response");
+ "response");
return (0);
}
if (resp->version != SNMP_V1 &&
@@ -1654,7 +1654,7 @@ ok_set(const struct snmp_pdu * req, cons
/*
* Simple checks for response PDUs against request PDUs. Return values: 1=ok,
- * 0=nosuchname or similar, -1=failure, -2=no response at all
+ * 0=nosuchname or similar, -1=failure, -2=no response at all
*/
int
snmp_pdu_check(const struct snmp_pdu *req,
@@ -1681,12 +1681,12 @@ snmp_pdu_check(const struct snmp_pdu *re
int
snmp_dialog(struct snmp_v1_pdu *req, struct snmp_v1_pdu *resp)
{
- u_int i;
- int32_t reqid;
- int ret;
- struct timeval tv = snmp_client.timeout;
+ struct timeval tv = snmp_client.timeout;
struct timeval end;
struct snmp_pdu pdu;
+ u_int i;
+ int32_t reqid;
+ int ret;
/*
* Make a copy of the request and replace the syntaxes by NULL
@@ -1698,11 +1698,11 @@ snmp_dialog(struct snmp_v1_pdu *req, str
for (i = 0; i < pdu.nbindings; i++)
pdu.bindings[i].syntax = SNMP_SYNTAX_NULL;
}
-
- for (i = 0; i <= snmp_client.retries; i++) {
+
+ for (i = 0; i <= snmp_client.retries; i++) {
(void)gettimeofday(&end, NULL);
timeradd(&end, &snmp_client.timeout, &end);
- if ((reqid = snmp_send_packet(&pdu)) == -1)
+ if ((reqid = snmp_send_packet(&pdu)) == -1)
return (-1);
for (;;) {
(void)gettimeofday(&tv, NULL);
@@ -1717,16 +1717,16 @@ snmp_dialog(struct snmp_v1_pdu *req, str
if (reqid == resp->request_id)
return (0);
/* not for us */
- (void)snmp_deliver_packet(resp);
+ (void)snmp_deliver_packet(resp);
}
if (ret < 0 && errno == EPIPE)
/* stream closed */
return (-1);
}
- }
+ }
errno = ETIMEDOUT;
seterr(&snmp_client, "retry count exceeded");
- return (-1);
+ return (-1);
}
int
More information about the svn-src-stable
mailing list