aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-10-13 15:02:45 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-10-13 15:02:45 -0400
commitae0d2e088fd20db7d5b8f7b02bef60cd1e987ba3 (patch)
tree76f3872e4a2c8c5eccefc72af42ad07569513f69
parent3d3e080ca86b410e42d74a9cdb74e78a5dcc328e (diff)
clean up temp files when done
Due to the logic between cleaning up threads and deleting temp files, the temp files were never deleted. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-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}