summaryrefslogtreecommitdiffstats
path: root/commands/saveenv.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-13 12:43:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-05-14 08:35:54 +0200
commit6188685091c58c9772b990cf0ca6ac522f97a9d0 (patch)
treeff994e79773e3bab5abe1b79129cbb08ddf9f754 /commands/saveenv.c
parent2f05b6925676e5f3263e0d51ed2f0a92201400d8 (diff)
downloadbarebox-6188685091c58c9772b990cf0ca6ac522f97a9d0.tar.gz
barebox-6188685091c58c9772b990cf0ca6ac522f97a9d0.tar.xz
Make errno a positive value
Normally errno contains a positive error value. A certain unnamed developer mixed this up while implementing U-Boot-v2. Also, normally errno is never set to zero by any library function. This patch fixes this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/saveenv.c')
-rw-r--r--commands/saveenv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/commands/saveenv.c b/commands/saveenv.c
index a4b279676d..549fcd4279 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -54,7 +54,7 @@ static int do_saveenv(int argc, char *argv[])
ret = protect(fd, ~0, 0, 0);
/* ENOSYS is no error here, many devices do not need it */
- if (ret && errno != -ENOSYS) {
+ if (ret && errno != ENOSYS) {
printf("could not unprotect %s: %s\n", filename, errno_str());
close(fd);
return 1;
@@ -63,7 +63,7 @@ static int do_saveenv(int argc, char *argv[])
ret = erase(fd, ~0, 0);
/* ENOSYS is no error here, many devices do not need it */
- if (ret && errno != -ENOSYS) {
+ if (ret && errno != ENOSYS) {
printf("could not erase %s: %s\n", filename, errno_str());
close(fd);
return 1;
@@ -82,7 +82,7 @@ static int do_saveenv(int argc, char *argv[])
ret = protect(fd, ~0, 0, 1);
/* ENOSYS is no error here, many devices do not need it */
- if (ret && errno != -ENOSYS) {
+ if (ret && errno != ENOSYS) {
printf("could not protect %s: %s\n", filename, errno_str());
close(fd);
return 1;