aboutsummaryrefslogtreecommitdiffstats
path: root/sys/syz-extract
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-16 14:21:05 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-25 10:12:41 +0100
commit55adcb8ca0ca0b7185e917ece137fae218365c89 (patch)
tree58b8661c65496f0a3fa2e7824bf1ebbc97c6d275 /sys/syz-extract
parent257f4cb9050d29a38a992b814bd6e79e6f1bca99 (diff)
all: use tool.Failf instead of local functions
Diffstat (limited to 'sys/syz-extract')
-rw-r--r--sys/syz-extract/extract.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go
index 477877d3c..d8ae1eeda 100644
--- a/sys/syz-extract/extract.go
+++ b/sys/syz-extract/extract.go
@@ -17,6 +17,7 @@ import (
"github.com/google/syzkaller/pkg/ast"
"github.com/google/syzkaller/pkg/compiler"
"github.com/google/syzkaller/pkg/osutil"
+ "github.com/google/syzkaller/pkg/tool"
"github.com/google/syzkaller/sys/targets"
)
@@ -69,30 +70,26 @@ var extractors = map[string]Extractor{
}
func main() {
- failf := func(msg string, args ...interface{}) {
- fmt.Fprintf(os.Stderr, msg+"\n", args...)
- os.Exit(1)
- }
flag.Parse()
if *flagBuild && *flagBuildDir != "" {
- failf("-build and -builddir is an invalid combination")
+ tool.Failf("-build and -builddir is an invalid combination")
}
OS, archArray, files, err := archFileList(*flagOS, *flagArch, flag.Args())
if err != nil {
- failf("%v", err)
+ tool.Fail(err)
}
extractor := extractors[OS]
if extractor == nil {
- failf("unknown os: %v", OS)
+ tool.Failf("unknown os: %v", OS)
}
arches, err := createArches(OS, archArray, files)
if err != nil {
- failf("%v", err)
+ tool.Fail(err)
}
if err := extractor.prepare(*flagSourceDir, *flagBuild, arches); err != nil {
- failf("%v", err)
+ tool.Fail(err)
}
jobC := make(chan interface{}, len(archArray)*len(files))
@@ -135,7 +132,7 @@ func main() {
continue
}
if err := osutil.WriteFile(outname, data); err != nil {
- failf("failed to write output file: %v", err)
+ tool.Failf("failed to write output file: %v", err)
}
}