pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bsdfetch: small bug fix.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vms%retrobsd.ddns.net@localhost>
Pushed By:	vms
Date:		Sun Dec 4 11:17:48 2022 +0100
Changeset:	63518317a61fa8ecef945324d774816c786b3d9c

Modified Files:
	bsdfetch/distinfo
	bsdfetch/patches/patch-bsdfetch.c

Log Message:
bsdfetch: small bug fix.

In get_loadavg(), change the maximum number of samples retrived by
getloadavg() from `-1' to `3', to avoid potentially storing more values
in the `lavg[3]' array than the array can contain.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=63518317a61fa8ecef945324d774816c786b3d9c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 bsdfetch/distinfo                 |  2 +-
 bsdfetch/patches/patch-bsdfetch.c | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs:
diff --git a/bsdfetch/distinfo b/bsdfetch/distinfo
index a5994e2411..78dd545022 100644
--- a/bsdfetch/distinfo
+++ b/bsdfetch/distinfo
@@ -4,5 +4,5 @@ BLAKE2s (bsdfetch-0.9-9840c3153fcf49150ebcee94f527f4ebcc0b8c1b.tar.gz) = ee4bd56
 SHA512 (bsdfetch-0.9-9840c3153fcf49150ebcee94f527f4ebcc0b8c1b.tar.gz) = b62d956f25eacc2426743c09523e89ade002fadd44445aa5c2628425b10d45d0133354be765af17fac78a936436197a8de5b02efd9c670dcdcf9513f0b744bb3
 Size (bsdfetch-0.9-9840c3153fcf49150ebcee94f527f4ebcc0b8c1b.tar.gz) = 6794 bytes
 SHA1 (patch-Makefile) = 62812c29b42d05ad9a9b1b9cc263ec309a7a4771
-SHA1 (patch-bsdfetch.c) = 703897e4c34b95327d9db8d7515231bd73f2b893
+SHA1 (patch-bsdfetch.c) = b9e1d1759fd54708a3e7610e1d27b51c5b57158d
 SHA1 (patch-sysctlbyname.c) = d00d3466cc3be82c7cf01ecfb6b5b12099adcc44
diff --git a/bsdfetch/patches/patch-bsdfetch.c b/bsdfetch/patches/patch-bsdfetch.c
index f008426dd7..1dfe92a560 100644
--- a/bsdfetch/patches/patch-bsdfetch.c
+++ b/bsdfetch/patches/patch-bsdfetch.c
@@ -136,7 +136,7 @@ Stability and portability fixes.
  
  		temperature_size = sizeof(buf);
  		if(sysctlbyname(buf, &temperature, &temperature_size, NULL, 0) == -1)
-@@ -171,17 +179,14 @@ static void get_cpu() {
+@@ -171,19 +179,16 @@ static void get_cpu() {
  	if(sysctl(mib, 5, &sensors, &size, NULL, 0) < 0)
  		return;
  
@@ -150,11 +150,14 @@ Stability and portability fixes.
  static void get_loadavg() {
 -	char tmp[20] = {0};
 -	double *lavg = NULL;
--
--	lavg = malloc(sizeof(double) * 3);
 +	double lavg[3];
  
- 	(void)getloadavg(lavg, -1);
+-	lavg = malloc(sizeof(double) * 3);
+-
+-	(void)getloadavg(lavg, -1);
++	(void)getloadavg(lavg, 3);
+ 
+ 	_SILENT sprintf(tmp, "%.2lf %.2lf %.2lf", lavg[0], lavg[1], lavg[2]);
  
 @@ -191,120 +196,45 @@ static void get_loadavg() {
  }


Home | Main Index | Thread Index | Old Index