1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-03 06:04:53 +00:00

Fix crash

Remove md5 sum

PR:		ports/151668
Submitted by:	Nikos Ntarmos (maintainer)
This commit is contained in:
Max Brazhnikov 2010-10-30 11:43:47 +00:00
parent 63a477b9ea
commit 725ed5ddea
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=263777
6 changed files with 106 additions and 2 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= conky PORTNAME= conky
PORTVERSION= 1.8.1 PORTVERSION= 1.8.1
PORTREVISION= 1
CATEGORIES= sysutils CATEGORIES= sysutils
MASTER_SITES= SF MASTER_SITES= SF

View File

@ -1,3 +1,2 @@
MD5 (conky-1.8.1.tar.bz2) = 366dc6a5c2ebebfbe6f53da25061b5d6
SHA256 (conky-1.8.1.tar.bz2) = f85a278f2869596b1fd68b6d26d58c93af8dcc39d5186bbcfd587d4c545e5e43 SHA256 (conky-1.8.1.tar.bz2) = f85a278f2869596b1fd68b6d26d58c93af8dcc39d5186bbcfd587d4c545e5e43
SIZE (conky-1.8.1.tar.bz2) = 612481 SIZE (conky-1.8.1.tar.bz2) = 612481

View File

@ -28,7 +28,23 @@
#endif /* AUDACIOUS */ #endif /* AUDACIOUS */
#ifdef BMPX #ifdef BMPX
@@ -6007,7 +6011,7 @@ @@ -5716,6 +5720,7 @@
"kvm_open")) == NULL) {
CRIT_ERR(NULL, NULL, "cannot read kvm");
}
+ pthread_mutex_init(&kvm_proc_mutex, NULL);
#endif
while (1) {
@@ -5999,6 +6004,7 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
kvm_close(kd);
+ pthread_mutex_destroy(&kvm_proc_mutex);
#endif
return 0;
@@ -6007,7 +6013,7 @@
void alarm_handler(void) { void alarm_handler(void) {
if(childpid > 0) { if(childpid > 0) {

View File

@ -0,0 +1,28 @@
--- src/exec.c.orig 2010-10-27 20:19:48.000000000 +0300
+++ src/exec.c 2010-10-27 20:19:52.000000000 +0300
@@ -93,6 +93,7 @@
} else {
close(1);
}
+ close(parentend);
dup(childend); //by dupping childend, the returned fd will have close-on-exec turned off
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
_exit(EXIT_FAILURE); //child should die here, (normally execl will take care of this but it can fail)
@@ -156,7 +157,7 @@
int length;
length = fread(buf, 1, size, fp);
- pclose(fp);
+ fclose(fp);
buf[length] = '\0';
if (length > 0 && buf[length - 1] == '\n') {
buf[length - 1] = '\0';
@@ -320,7 +321,7 @@
ed->buffer = malloc(text_buffer_size);
length = fread(ed->buffer, 1, text_buffer_size, fp);
- pclose(fp);
+ fclose(fp);
output = ed->buffer;
output[length] = '\0';

View File

@ -0,0 +1,44 @@
--- src/freebsd.c.orig 2010-10-24 03:14:05.000000000 +0300
+++ src/freebsd.c 2010-10-24 03:13:05.000000000 +0300
@@ -266,7 +266,9 @@
{
int n_processes;
+ pthread_mutex_lock(&kvm_proc_mutex);
kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
+ pthread_mutex_unlock(&kvm_proc_mutex);
info.procs = n_processes;
return 0;
@@ -278,6 +280,7 @@
int n_processes;
int i, cnt = 0;
+ pthread_mutex_lock(&kvm_proc_mutex);
p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
for (i = 0; i < n_processes; i++) {
#if (__FreeBSD__ < 5) && (__FreeBSD_kernel__ < 5)
@@ -288,6 +291,7 @@
cnt++;
}
}
+ pthread_mutex_unlock(&kvm_proc_mutex);
info.run_procs = cnt;
return 0;
@@ -748,6 +752,7 @@
CRIT_ERR(NULL, NULL, "Cannot read sysctl \"vm.stats.vm.v_page_count\"");
}
+ pthread_mutex_lock(&kvm_proc_mutex);
p = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_processes);
processes = malloc(n_processes * sizeof(struct process));
@@ -764,6 +769,7 @@
j++;
}
}
+ pthread_mutex_unlock(&kvm_proc_mutex);
qsort(processes, j - 1, sizeof(struct process), comparemem);
for (i = 0; i < 10 && i < n_processes; i++) {

View File

@ -0,0 +1,16 @@
--- src/freebsd.h.orig 2010-10-24 03:14:11.000000000 +0300
+++ src/freebsd.h 2010-10-24 03:13:05.000000000 +0300
@@ -9,11 +9,13 @@
#include <sys/ucred.h>
#include <fcntl.h>
#include <kvm.h>
+#include <pthread.h>
#if (defined(i386) || defined(__i386__))
#include <machine/apm_bios.h>
#endif /* i386 || __i386__ */
kvm_t *kd;
+pthread_mutex_t kvm_proc_mutex;
int get_entropy_avail(unsigned int *);
int get_entropy_poolsize(unsigned int *);