View | Details | Raw Unified | Return to bug 168907
Collapse All | Expand All

(-)./Makefile (-6 / +6 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	fcitx
8
PORTNAME=	fcitx
9
PORTVERSION=	4.2.3
9
PORTVERSION=	4.2.3
10
PORTREVISION=	2
10
PORTREVISION=	3
11
CATEGORIES=	chinese x11
11
CATEGORIES=	chinese x11
12
MASTER_SITES=	${MASTER_SITE_GOOGLE_CODE}
12
MASTER_SITES=	${MASTER_SITE_GOOGLE_CODE}
13
DISTFILES=	${DISTNAME}${EXTRACT_SUFX} pinyin.tar.gz table.tar.gz
13
DISTFILES=	${DISTNAME}${EXTRACT_SUFX} pinyin.tar.gz table.tar.gz
Lines 38-48 Link Here
38
38
39
OPTIONS_DEFINE=	GTK2 GTK3 QT4 OPENCC TPUNC
39
OPTIONS_DEFINE=	GTK2 GTK3 QT4 OPENCC TPUNC
40
40
41
GTK2_DESC=	"Enable Gtk2 IM module"
41
GTK2_DESC=	Enable Gtk2 IM module
42
GTK3_DESC=	"Enable Gtk3 IM module"
42
GTK3_DESC=	Enable Gtk3 IM module
43
QT4_DESC=	"Enable Qt4 IM module"
43
QT4_DESC=	Enable Qt4 IM module
44
OPENCC_DESC=	"Enable OpenCC for Chinese Transform"
44
OPENCC_DESC=	Enable OpenCC for Chinese Transform
45
TPUNC_DESC=	"Use traditional quotation marks"
45
TPUNC_DESC=	Use traditional quotation marks
46
46
47
.include <bsd.port.options.mk>
47
.include <bsd.port.options.mk>
48
48
(-)./files/patch-src_lib_fcitx-utils_utils.c (+78 lines)
Line 0 Link Here
1
diff --git src/lib/fcitx-utils/utils.c src/lib/fcitx-utils/utils.c
2
index c97ff44..473abc3 100644
3
--- src/lib/fcitx-utils/utils.c
4
+++ src/lib/fcitx-utils/utils.c
5
@@ -337,19 +337,23 @@ int fcitx_utils_pid_exists(pid_t pid)
6
     if (vm == 0) // ignore all error
7
         return 1;
8
 
9
-    int cnt;
10
-    struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, pid, &cnt);
11
-    if (kp == 0)
12
-        return 1;
13
-    int i;
14
-    for (i = 0; i < cnt; i++)
15
-        if (kp->ki_pid == pid)
16
+    int result = 1;
17
+    do {
18
+        int cnt;
19
+        struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, pid, &cnt);
20
+        if (kp == 0) {
21
+            result = 1;
22
             break;
23
-    int result;
24
-    if (i != cnt)
25
-        result = 1;
26
-    else
27
-        result = 0;
28
+        }
29
+        int i;
30
+        for (i = 0; i < cnt; i++)
31
+            if (kp->ki_pid == pid)
32
+                break;
33
+        if (i != cnt)
34
+            result = 1;
35
+        else
36
+            result = 0;
37
+    } while (0);
38
     kvm_close(vm);
39
     return result;
40
 #else
41
@@ -386,21 +390,24 @@ char* fcitx_utils_get_process_name()
42
     if (vm == 0)
43
         return strdup("");
44
 
45
-    int cnt;
46
-    int mypid = getpid();
47
-    struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, mypid, &cnt);
48
-    if ((cnt != 1) || (kp == 0))
49
-        return strdup("");
50
-    int i;
51
-    for (i = 0; i < cnt; i++)
52
-        if (kp->ki_pid == mypid)
53
-            break;
54
     char* result = NULL;
55
-    if (i != cnt)
56
-        result = strdup(kp->ki_comm);
57
-    else
58
-        result = strdup("");
59
+    do {
60
+        int cnt;
61
+        int mypid = getpid();
62
+        struct kinfo_proc * kp = kvm_getprocs(vm, KERN_PROC_PID, mypid, &cnt);
63
+        if ((cnt != 1) || (kp == 0)) {
64
+            break;
65
+        }
66
+        int i;
67
+        for (i = 0; i < cnt; i++)
68
+            if (kp->ki_pid == mypid)
69
+                break;
70
+        if (i != cnt)
71
+            result = strdup(kp->ki_comm);
72
+    } while (0);
73
     kvm_close(vm);
74
+    if (result == NULL)
75
+        result = strdup("");
76
     return result;
77
 #else
78
     return strdup("");

Return to bug 168907