summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index b7174133..f32350ba 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -246,18 +246,22 @@ readGbe(void)
void
cmd_setmac(void)
{
+ int mac_updated = 0;
parseMacString(strMac, mac);
for (int partnum = 0; partnum < 2; partnum++) {
if (!goodChecksum(part = partnum))
continue;
- errno = 0;
+ mac_updated = 1;
for (int w = 0; w < 3; w++) /* write MAC to gbe part */
setWord(w, partnum, mac[w]);
cmd_setchecksum(); /* MAC updated; need valid checksum */
}
+
+ if (mac_updated)
+ errno = 0; /* reset in case one of the checksums failed */
}
/* parse MAC string, write to char buffer */