aboutsummaryrefslogtreecommitdiffstats
path: root/trace-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-cmd.c')
-rw-r--r--trace-cmd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/trace-cmd.c b/trace-cmd.c
index 25e9692..5080f98 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -91,9 +91,10 @@ static void kill_threads(void)
91 return; 91 return;
92 92
93 for (i = 0; i < cpu_count; i++) { 93 for (i = 0; i < cpu_count; i++) {
94 if (pids[i]) { 94 if (pids[i] > 0) {
95 kill(pids[i], SIGKILL); 95 kill(pids[i], SIGKILL);
96 delete_temp_file(i); 96 delete_temp_file(i);
97 pids[i] = 0;
97 } 98 }
98 } 99 }
99} 100}
@@ -106,8 +107,11 @@ static void delete_thread_data(void)
106 return; 107 return;
107 108
108 for (i = 0; i < cpu_count; i++) { 109 for (i = 0; i < cpu_count; i++) {
109 if (pids[i]) 110 if (pids[i]) {
110 delete_temp_file(i); 111 delete_temp_file(i);
112 if (pids[i] < 0)
113 pids[i] = 0;
114 }
111 } 115 }
112} 116}
113 117
@@ -119,10 +123,10 @@ static void stop_threads(void)
119 return; 123 return;
120 124
121 for (i = 0; i < cpu_count; i++) { 125 for (i = 0; i < cpu_count; i++) {
122 if (pids[i]) { 126 if (pids[i] > 0) {
123 kill(pids[i], SIGINT); 127 kill(pids[i], SIGINT);
124 waitpid(pids[i], NULL, 0); 128 waitpid(pids[i], NULL, 0);
125 pids[i] = 0; 129 pids[i] = -1;
126 } 130 }
127 } 131 }
128} 132}