From f3d9d5948cad441ab08e763c8ed86efe79f4198b Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Tue, 11 Dec 2018 14:30:49 -0800 Subject: pkg/csource: support tun and setuid repros on {free,open}bsd * expose procid on BSD for tun, always declare loop() * deal with terrible bsd includes * replicate loop() declaration --- pkg/csource/csource.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'pkg/csource/csource.go') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index aa5f615e1..91e66e1cd 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -430,21 +430,23 @@ func (ctx *context) hoistIncludes(result []byte) []byte { includes[string(match)] = true } result = includeRe.ReplaceAll(result, nil) - // Linux headers are broken, so we have to move all linux includes to the bottom. - var sorted, sortedLinux []string + // Certain linux and bsd headers are broken and go to the bottom. + var sorted, sortedBottom []string for include := range includes { if strings.Contains(include, "") { + sortedBottom = append(sortedBottom, include) } else { sorted = append(sorted, include) } } sort.Strings(sorted) - sort.Strings(sortedLinux) + sort.Strings(sortedBottom) newResult := append([]byte{}, result[:includesStart]...) newResult = append(newResult, strings.Join(sorted, "")...) newResult = append(newResult, '\n') - newResult = append(newResult, strings.Join(sortedLinux, "")...) + newResult = append(newResult, strings.Join(sortedBottom, "")...) newResult = append(newResult, result[includesStart:]...) return newResult } -- cgit mrf-deployment