[Git][NTPsec/ntpsec][master] Don't use non-boolean operators for boolean operands
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Aug 12 20:12:23 UTC 2018
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
14ad813c by Matt Selsky at 2018-08-12T03:15:07Z
Don't use non-boolean operators for boolean operands
Reported by Sonarcloud.io:
"Reconsider this operator for 'bool' operand."
- - - - -
3 changed files:
- libntp/ntp_calendar.c
- ntpd/ntp_refclock.c
- ntpd/ntp_sandbox.c
Changes:
=====================================
libntp/ntp_calendar.c
=====================================
@@ -234,7 +234,7 @@ ntpcal_periodic_extend(
diff = (uint32_t)value - (uint32_t)pivot;
} else {
diff = (uint32_t)pivot - (uint32_t)value;
- cpl ^= 1;
+ cpl = !cpl;
}
diff %= (uint32_t)cycle;
if (diff) {
=====================================
ntpd/ntp_refclock.c
=====================================
@@ -1028,7 +1028,7 @@ refclock_catcher(
return PPS_SETUP;
if (ap->pps_params.mode == 0 && sys_vars.sys_leap != LEAP_NOTINSYNC) {
- if (refclock_params(pp->sloppyclockflag, ap) < 1)
+ if (!refclock_params(pp->sloppyclockflag, ap))
return PPS_SETUP;
}
timeout.tv_sec = 0;
=====================================
ntpd/ntp_sandbox.c
=====================================
@@ -213,7 +213,7 @@ getgroup:
* is associated with running with uid 0 - should be refined on
* ports that allow binding to NTP_PORT with uid != 0
*/
- nonroot |= (sw_uid != 0); /* also notifies routing message listener */
+ nonroot = nonroot || (sw_uid != 0); /* also notifies routing message listener */
# endif /* !HAVE_LINUX_CAPABILITY && !HAVE_SOLARIS_PRIVS */
# ifdef HAVE_LINUX_CAPABILITY
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/14ad813ca3a1f132336809ff525dc5de17dfda82
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/14ad813ca3a1f132336809ff525dc5de17dfda82
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180812/61deb73a/attachment-0001.html>
More information about the vc
mailing list