- Upstream patch to fix libkvm fd leaking
- Bump PORTREVISION PR: ports/168907 Submitted by: Zhihao Yuan <lichray@gmail.com> (maintainer) Obtained from: http://paste.opensuse.org/23129601
This commit is contained in:
parent
416fbeb0b5
commit
47631c222e
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=298934
2 changed files with 84 additions and 6 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
PORTNAME= fcitx
|
||||
PORTVERSION= 4.2.3
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= chinese x11
|
||||
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}
|
||||
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} pinyin.tar.gz table.tar.gz
|
||||
|
@ -38,11 +38,11 @@ INSTALLS_ICONS= yes
|
|||
|
||||
OPTIONS_DEFINE= GTK2 GTK3 QT4 OPENCC TPUNC
|
||||
|
||||
GTK2_DESC= "Enable Gtk2 IM module"
|
||||
GTK3_DESC= "Enable Gtk3 IM module"
|
||||
QT4_DESC= "Enable Qt4 IM module"
|
||||
OPENCC_DESC= "Enable OpenCC for Chinese Transform"
|
||||
TPUNC_DESC= "Use traditional quotation marks"
|
||||
GTK2_DESC= Enable Gtk2 IM module
|
||||
GTK3_DESC= Enable Gtk3 IM module
|
||||
QT4_DESC= Enable Qt4 IM module
|
||||
OPENCC_DESC= Enable OpenCC for Chinese Transform
|
||||
TPUNC_DESC= Use traditional quotation marks
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
|
|
78
chinese/fcitx/files/patch-src_lib_fcitx-utils_utils.c
Normal file
78
chinese/fcitx/files/patch-src_lib_fcitx-utils_utils.c
Normal file
|
@ -0,0 +1,78 @@
|
|||
diff --git src/lib/fcitx-utils/utils.c src/lib/fcitx-utils/utils.c
|
||||
index c97ff44..473abc3 100644
|
||||
--- src/lib/fcitx-utils/utils.c
|
||||
+++ src/lib/fcitx-utils/utils.c
|
||||
@@ -337,19 +337,23 @@ int fcitx_utils_pid_exists(pid_t pid)
|
||||
if (vm == 0) // ignore all error
|
||||
return 1;
|
||||
|
||||
- int cnt;
|
||||
- struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, pid, &cnt);
|
||||
- if (kp == 0)
|
||||
- return 1;
|
||||
- int i;
|
||||
- for (i = 0; i < cnt; i++)
|
||||
- if (kp->ki_pid == pid)
|
||||
+ int result = 1;
|
||||
+ do {
|
||||
+ int cnt;
|
||||
+ struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, pid, &cnt);
|
||||
+ if (kp == 0) {
|
||||
+ result = 1;
|
||||
break;
|
||||
- int result;
|
||||
- if (i != cnt)
|
||||
- result = 1;
|
||||
- else
|
||||
- result = 0;
|
||||
+ }
|
||||
+ int i;
|
||||
+ for (i = 0; i < cnt; i++)
|
||||
+ if (kp->ki_pid == pid)
|
||||
+ break;
|
||||
+ if (i != cnt)
|
||||
+ result = 1;
|
||||
+ else
|
||||
+ result = 0;
|
||||
+ } while (0);
|
||||
kvm_close(vm);
|
||||
return result;
|
||||
#else
|
||||
@@ -386,21 +390,24 @@ char* fcitx_utils_get_process_name()
|
||||
if (vm == 0)
|
||||
return strdup("");
|
||||
|
||||
- int cnt;
|
||||
- int mypid = getpid();
|
||||
- struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, mypid, &cnt);
|
||||
- if ((cnt != 1) || (kp == 0))
|
||||
- return strdup("");
|
||||
- int i;
|
||||
- for (i = 0; i < cnt; i++)
|
||||
- if (kp->ki_pid == mypid)
|
||||
- break;
|
||||
char* result = NULL;
|
||||
- if (i != cnt)
|
||||
- result = strdup(kp->ki_comm);
|
||||
- else
|
||||
- result = strdup("");
|
||||
+ do {
|
||||
+ int cnt;
|
||||
+ int mypid = getpid();
|
||||
+ struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, mypid, &cnt);
|
||||
+ if ((cnt != 1) || (kp == 0)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ int i;
|
||||
+ for (i = 0; i < cnt; i++)
|
||||
+ if (kp->ki_pid == mypid)
|
||||
+ break;
|
||||
+ if (i != cnt)
|
||||
+ result = strdup(kp->ki_comm);
|
||||
+ } while (0);
|
||||
kvm_close(vm);
|
||||
+ if (result == NULL)
|
||||
+ result = strdup("");
|
||||
return result;
|
||||
#else
|
||||
return strdup("");
|
Loading…
Reference in a new issue