Skip to contentSkip to conversation

checkpatch: Report the right line # when using --emacs and --file

PATCH New Joe Perches 1 participant 1 message Jul 23, 2015 Checkpatch

lore
Share & tools
lore

Joe Perches

author maintainer
#0 lore raw

PATCH 1/1 checkpatch: Report the right line # when using --emacs and --file

commit 34d8815f9512 ("checkpatch: add --showfile to allow input via pipe to show filenames") broke the --emacs with --file option.

Fix it.

---
 scripts/checkpatch.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +5 -1
index c0a95aa..137bd1c 100755
@@ -2166,7 +2166,11 @@ sub process {
 		if ($showfile) {
 			$prefix = "$realfile:$realline: "
 		} elsif ($emacs) {
-			$prefix = "$filename:$linenr: ";
+			if ($file) {
+				$prefix = "$filename:$realline: ";
+			} else {
+				$prefix = "$filename:$linenr: ";
+			}
 		}
 
 		if ($found_file) {