aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-13 14:48:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-13 15:37:26 +0200
commit60d836d3726332d1a13cf2e62806471ccbdb5e50 (patch)
treed2a3ea5ac4c45360fec8b1f4fa34e8d1085af826 /executor
parentcc59e7e4adf110e2ddd4f8ae57df8ecc7b369b38 (diff)
executor: fix style checking test
The regexp for empty suppressions matches _everything_... Don't match suppression if it's empty.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h2
-rw-r--r--executor/executor_bsd.h1
-rw-r--r--executor/style_test.go6
3 files changed, 4 insertions, 5 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 8f38fabd7..b9a67418b 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -3482,7 +3482,7 @@ static int do_sandbox_setuid(void)
if (syscall(SYS_setresuid, nobody, nobody, nobody))
fail("failed to setresuid");
- // This is required to open /proc/self/* files.
+ // This is required to open /proc/self/ files.
// Otherwise they are owned by root and we can't open them after setuid.
// See task_dump_owner function in kernel.
prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h
index fd4bf0422..69c6a132b 100644
--- a/executor/executor_bsd.h
+++ b/executor/executor_bsd.h
@@ -192,6 +192,5 @@ static feature_t features[] = {
static void setup_machine(void)
{
- /* nothing */
}
#endif
diff --git a/executor/style_test.go b/executor/style_test.go
index c3fde4889..9e09709ff 100644
--- a/executor/style_test.go
+++ b/executor/style_test.go
@@ -73,13 +73,13 @@ if (foo)
supp := regexp.MustCompile(check.suppression)
for _, match := range re.FindAllIndex(data, -1) {
start, end := match[0], match[1]
- for start != 0 && data[start-1] != '\n' {
+ for check.pattern[0] != '\n' && start != 0 && data[start-1] != '\n' {
start--
}
- for end != len(data) && data[end] != '\n' {
+ for check.pattern[len(check.pattern)-1] != '\n' && end != len(data) && data[end] != '\n' {
end++
}
- if supp.Match(data[start:end]) {
+ if check.suppression != "" && supp.Match(data[start:end]) {
continue
}
line := bytes.Count(data[:start], []byte{'\n'}) + 1