logcat: fix "-c is ambiguous with both -f and -L specified" when -c wasn't specified.
Bug: http://b/199046044
Test: treehugger
Change-Id: Ic9ba6e1c43b487409530c2fc1b08acf8a9e8a398
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 25fda5d..51a7194 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -898,13 +898,13 @@
}
if (mode & ANDROID_LOG_PSTORE) {
- if (output_file_name_) {
- error(EXIT_FAILURE, 0, "-c is ambiguous with both -f and -L specified.");
- }
if (setLogSize || getLogSize || printStatistics || getPruneList || setPruneList) {
error(EXIT_FAILURE, 0, "-L is incompatible with -g/-G, -S, and -p/-P.");
}
if (clearLog) {
+ if (output_file_name_) {
+ error(EXIT_FAILURE, 0, "-c is ambiguous with both -f and -L specified.");
+ }
unlink("/sys/fs/pstore/pmsg-ramoops-0");
return EXIT_SUCCESS;
}