Commit 76811213 authored by Mohit Agarwal's avatar Mohit Agarwal Committed by Ian Lance Taylor
Browse files

cmd/go: check if destination is a regular file

builder.copyFile ensures that the destination is an object file.  This
wouldn't be true if we are not writing to a regular file and the copy
fails.  Check if the destination is an object file only if we are
writing to a regular file.  While removing the file, ensure that it is a
regular file so that device files and such aren't removed when running
as a user with suggicient privileges.

Fixes #12407

Change-Id: Ie86ce9770fa59aa56fc486a5962287859b69db3d
Reviewed-on: https://go-review.googlesource.com/16585


Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 3a765430
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment