snmpd(8): fix compilation warnings with DEBUG

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

snmpd(8): fix compilation warnings with DEBUG

Rafael Zalamena-2
This diff fixes two compiler warnings when compiling with DEBUG define.

ok?


Index: timer.c
===================================================================
RCS file: /home/obsdcvs/src/usr.sbin/snmpd/timer.c,v
retrieving revision 1.5
diff -u -p -r1.5 timer.c
--- timer.c 27 Aug 2016 01:50:07 -0000 1.5
+++ timer.c 23 Sep 2016 19:23:22 -0000
@@ -70,7 +70,7 @@ timer_cpu(int fd, short event, void *arg
  (void)percentages(CPUSTATES, cptime2, cp_time[n],
     cp_old[n], cp_diff[n]);
 #ifdef DEBUG
- log_debug("timer_cpu: cpu%d %d%% idle in %ds", n,
+ log_debug("timer_cpu: cpu%d %llu%% idle in %llus", n,
     (cptime2[CP_IDLE] > 1000 ?
     1000 : (cptime2[CP_IDLE] / 10)), tv.tv_sec);
 #endif

Reply | Threaded
Open this post in threaded view
|

Re: snmpd(8): fix compilation warnings with DEBUG

Stuart Henderson
On 2016/09/26 15:20, Rafael Zalamena wrote:
> This diff fixes two compiler warnings when compiling with DEBUG define.
>
> ok?

I think this would be preferred:

Index: timer.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/timer.c,v
retrieving revision 1.5
diff -u -p -r1.5 timer.c
--- timer.c 27 Aug 2016 01:50:07 -0000 1.5
+++ timer.c 26 Sep 2016 13:35:51 -0000
@@ -70,9 +70,9 @@ timer_cpu(int fd, short event, void *arg
  (void)percentages(CPUSTATES, cptime2, cp_time[n],
     cp_old[n], cp_diff[n]);
 #ifdef DEBUG
- log_debug("timer_cpu: cpu%d %d%% idle in %ds", n,
+ log_debug("timer_cpu: cpu%d %lld%% idle in %llds", n,
     (cptime2[CP_IDLE] > 1000 ?
-    1000 : (cptime2[CP_IDLE] / 10)), tv.tv_sec);
+    1000 : (cptime2[CP_IDLE] / 10)), (long long) tv.tv_sec);
 #endif
  }
 
Also spotted:

usm.o: In function `usm_crypt':
usm.c:(.text+0x9ff): warning: warning: EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup

Reply | Threaded
Open this post in threaded view
|

Re: snmpd(8): fix compilation warnings with DEBUG

Reyk Floeter-2

> On 26.09.2016, at 15:37, Stuart Henderson <[hidden email]> wrote:
>
> On 2016/09/26 15:20, Rafael Zalamena wrote:
>> This diff fixes two compiler warnings when compiling with DEBUG define.
>>
>> ok?
>
> I think this would be preferred:
>

I agree, this is the correct fix. OK reyk@

> Index: timer.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/snmpd/timer.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 timer.c
> --- timer.c 27 Aug 2016 01:50:07 -0000 1.5
> +++ timer.c 26 Sep 2016 13:35:51 -0000
> @@ -70,9 +70,9 @@ timer_cpu(int fd, short event, void *arg
> (void)percentages(CPUSTATES, cptime2, cp_time[n],
>    cp_old[n], cp_diff[n]);
> #ifdef DEBUG
> - log_debug("timer_cpu: cpu%d %d%% idle in %ds", n,
> + log_debug("timer_cpu: cpu%d %lld%% idle in %llds", n,
>    (cptime2[CP_IDLE] > 1000 ?
> -    1000 : (cptime2[CP_IDLE] / 10)), tv.tv_sec);
> +    1000 : (cptime2[CP_IDLE] / 10)), (long long) tv.tv_sec);
> #endif
> }
>
> Also spotted:
>
> usm.o: In function `usm_crypt':
> usm.c:(.text+0x9ff): warning: warning: EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup
>