add (un)protect to saveenv
This commit is contained in:
parent
e354093310
commit
99978d467a
|
@ -138,6 +138,14 @@ int do_saveenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
ret = protect(fd, ~0, 0, 0);
|
||||
/* ENOSYS is no error here, many devices do not need it */
|
||||
if (ret && errno != -ENOSYS) {
|
||||
printf("could not unprotect %s: %s\n", filename, errno_str());
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = erase(fd, ~0, 0);
|
||||
|
||||
/* ENOSYS is no error here, many devices do not need it */
|
||||
|
@ -151,6 +159,14 @@ int do_saveenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
|||
if (ret)
|
||||
printf("saveenv failed\n");
|
||||
|
||||
ret = protect(fd, ~0, 0, 1);
|
||||
/* ENOSYS is no error here, many devices do not need it */
|
||||
if (ret && errno != -ENOSYS) {
|
||||
printf("could not protect %s: %s\n", filename, errno_str());
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue