From 6f6f3f710b4dec2952298ae65d5f1674535c63f0 Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Wed, 27 Mar 2013 15:50:30 -0700 Subject: [PATCH] atrace: fix tracing on user builds Change-Id: Idef15d514f0bd1e117362c6a06a2ea24314feb7f --- cmds/atrace/atrace.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp index d85a1d74d..b41738313 100644 --- a/cmds/atrace/atrace.cpp +++ b/cmds/atrace/atrace.cpp @@ -433,8 +433,10 @@ static bool setKernelTraceFuncs(const char* funcs) if (funcs == NULL || funcs[0] == '\0') { // Disable kernel function tracing. - ok &= writeStr(k_currentTracerPath, "nop"); - if (fileExists(k_ftraceFilterPath)) { + if (fileIsWritable(k_currentTracerPath)) { + ok &= writeStr(k_currentTracerPath, "nop"); + } + if (fileIsWritable(k_ftraceFilterPath)) { ok &= truncateFile(k_ftraceFilterPath); } } else { @@ -761,11 +763,11 @@ int main(int argc, char **argv) case 'k': g_kernelTraceFuncs = optarg; - break; + break; case 'n': g_nohup = true; - break; + break; case 's': g_initialSleepSecs = atoi(optarg); @@ -796,7 +798,7 @@ int main(int argc, char **argv) listSupportedCategories(); exit(0); } - break; + break; default: fprintf(stderr, "\n");