+2019-03-03 Bruno Haible <bruno@clisp.org>
+
+ getloadavg: Write NULL for the null pointer.
+ Reported by Michal Privoznik <mprivozn@redhat.com>.
+ * lib/getloadavg.c (getloadavg): Write NULL instead of 0.
+
2019-02-28 Michal Privoznik <mprivozn@redhat.com>
alloca, tsearch-tests: Write NULL for the null pointer.
int saved_errno;
kc = kstat_open ();
- if (kc == 0)
+ if (kc == NULL)
return -1;
ksp = kstat_lookup (kc, "unix", 0, "system_misc");
- if (ksp == 0)
+ if (ksp == NULL)
return -1;
if (kstat_read (kc, ksp, 0) == -1)
return -1;
kn = kstat_data_lookup (ksp, "avenrun_1min");
- if (kn == 0)
+ if (kn == NULL)
{
/* Return -1 if no load average information is available. */
nelem = 0;
if (nelem >= 2)
{
kn = kstat_data_lookup (ksp, "avenrun_5min");
- if (kn != 0)
+ if (kn != NULL)
{
loadavg[elem++] = (double) kn->value.ul / FSCALE;
if (nelem >= 3)
{
kn = kstat_data_lookup (ksp, "avenrun_15min");
- if (kn != 0)
+ if (kn != NULL)
loadavg[elem++] = (double) kn->value.ul / FSCALE;
}
}
/* We pass 0 for the kernel, corefile, and swapfile names
to use the currently running kernel. */
kd = kvm_open (0, 0, 0, O_RDONLY, 0);
- if (kd != 0)
+ if (kd != NULL)
{
/* nlist the currently running kernel. */
kvm_nlist (kd, name_list);