Skip to content

Commit

Permalink
Fix stat error when signing inputs that aren't a regular file
Browse files Browse the repository at this point in the history
  • Loading branch information
mtharp committed Jul 31, 2019
1 parent dfd7cbb commit 1ba272b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/binpatch/binpatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ func (p *PatchSet) Dump() []byte {
// output will be written to a temporary file then renamed over the destination
// path.
func (p *PatchSet) Apply(infile *os.File, outpath string) error {
ininfo, err := infile.Stat()
if err != nil {
return err
}
if outpath == "" {
outpath = infile.Name()
}
// Determine if an in-place overwrite is possible. If any test fails then
// fall back to doing a full copy (write-rename).
ininfo, err := infile.Stat()
if err != nil {
return p.applyRewrite(infile, outpath)
}
outinfo, err := os.Lstat(outpath)
if err != nil || !canOverwrite(ininfo, outinfo) {
return p.applyRewrite(infile, outpath)
Expand Down

0 comments on commit 1ba272b

Please sign in to comment.