aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/driver
diff options
context:
space:
mode:
authorHana <hyangah@gmail.com>2020-10-07 17:27:42 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2020-10-22 23:33:06 +0000
commit67bce7c1cf6540a853c6b8a9721e381c8258d7dc (patch)
treeb4619ed6f4222f549ed28a448b71229839c9b69b /src/cmd/vendor/github.com/google/pprof/internal/driver
parentad36f871512ea54a9044e256b2743b8346b725dd (diff)
downloadgo-67bce7c1cf6540a853c6b8a9721e381c8258d7dc.tar.xz
cmd/vendor: sync pprof@v0.0.0-20201007051231-1066cbb265c7
This is a belated early sync for 1.16 dev cycle For #36905 Change-Id: I387528ae897794841c0c78b0f0910fc5ce8599ab Reviewed-on: https://go-review.googlesource.com/c/go/+/260538 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go2
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go18
2 files changed, 13 insertions, 7 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
index 048ba17cb0..fd05adb146 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver_focus.go
@@ -58,7 +58,7 @@ func applyFocus(prof *profile.Profile, numLabelUnits map[string]string, cfg conf
taghide, err := compileRegexOption("taghide", cfg.TagHide, err)
tns, tnh := prof.FilterTagsByName(tagshow, taghide)
warnNoMatches(tagshow == nil || tns, "TagShow", ui)
- warnNoMatches(tagignore == nil || tnh, "TagHide", ui)
+ warnNoMatches(taghide == nil || tnh, "TagHide", ui)
if prunefrom != nil {
prof.PruneFrom(prunefrom)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
index 28679f1c15..b6c8776ff8 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/tempfile.go
@@ -24,9 +24,11 @@ import (
// newTempFile returns a new output file in dir with the provided prefix and suffix.
func newTempFile(dir, prefix, suffix string) (*os.File, error) {
for index := 1; index < 10000; index++ {
- path := filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix))
- if _, err := os.Stat(path); err != nil {
- return os.Create(path)
+ switch f, err := os.OpenFile(filepath.Join(dir, fmt.Sprintf("%s%03d%s", prefix, index, suffix)), os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666); {
+ case err == nil:
+ return f, nil
+ case !os.IsExist(err):
+ return nil, err
}
}
// Give up
@@ -44,11 +46,15 @@ func deferDeleteTempFile(path string) {
}
// cleanupTempFiles removes any temporary files selected for deferred cleaning.
-func cleanupTempFiles() {
+func cleanupTempFiles() error {
tempFilesMu.Lock()
+ defer tempFilesMu.Unlock()
+ var lastErr error
for _, f := range tempFiles {
- os.Remove(f)
+ if err := os.Remove(f); err != nil {
+ lastErr = err
+ }
}
tempFiles = nil
- tempFilesMu.Unlock()
+ return lastErr
}