diff options
| author | 2023-10-20 13:52:29 +0000 | |
|---|---|---|
| committer | 2023-10-20 14:11:50 +0000 | |
| commit | c34489c91ed1d589045b73156d8875994de1ae2b (patch) | |
| tree | 33860646023f1650b9402dc422ac83ab0e6fe71a | |
| parent | 3feea1b9aadf0777d1a2db15aa9b777a7b19d1b8 (diff) | |
Fix file permissions of generated layers trace
Fix: 305129514
Test: adb shell rm /data/misc/wmtrace/layers_trace_from_transactions.winscope \
&& adb bugreport \
&& check generated bugreport contains FS/data/misc/wmtrace/layers_trace_from_transactions.winscope
Change-Id: I7cf087265df9ce1cc5da8536d6b03285685cd26e
| -rw-r--r-- | services/surfaceflinger/Tracing/tools/main.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/services/surfaceflinger/Tracing/tools/main.cpp b/services/surfaceflinger/Tracing/tools/main.cpp index 698ef06534..18022b1697 100644 --- a/services/surfaceflinger/Tracing/tools/main.cpp +++ b/services/surfaceflinger/Tracing/tools/main.cpp @@ -64,8 +64,17 @@ int main(int argc, char** argv) { if (!LayerTraceGenerator().generate(transactionTraceFile, traceFlags, layerTracing, generateLastEntryOnly)) { - std::cout << "Error: Failed to generate layers trace " << outputLayersTracePath; + std::cout << "Error: Failed to generate layers trace " << outputLayersTracePath << "\n"; return -1; } + + // Set output file permissions (-rw-r--r--) + outStream.close(); + const mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + if (chmod(outputLayersTracePath, mode) != 0) { + std::cout << "Error: Failed to set permissions of " << outputLayersTracePath << "\n"; + return -1; + } + return 0; } |