You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2020/01/28 17:26:08 UTC
[mynewt-newt] 04/09: toolchain: Check for error when deleting .a
file
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit cf66769bc901e79c93ea2bc88e822f76f0f9577f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Jan 27 10:56:22 2020 -0800
toolchain: Check for error when deleting .a file
The code was checking the `err` variable without assigning it. As a
result, it was checking for an error from a prior operation (which was
already being checked).
---
newt/toolchain/compiler.go | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index a1851e5..05dc424 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -1246,15 +1246,14 @@ func (c *Compiler) CompileArchive(archiveFile string) error {
return nil
}
- // Delete the old archive, if it exists.
- os.Remove(archiveFile)
-
util.StatusMessage(util.VERBOSITY_DEFAULT, "Archiving %s",
path.Base(archiveFile))
util.StatusMessage(util.VERBOSITY_VERBOSE, " with object files %s",
strings.Join(objList, " "))
util.StatusMessage(util.VERBOSITY_DEFAULT, "\n")
+ // Delete the old archive, if it exists.
+ err = os.Remove(archiveFile)
if err != nil && !os.IsNotExist(err) {
return util.NewNewtError(err.Error())
}