]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/env/fw_env.c
tools/env: Add environment variable flags support
[karo-tx-uboot.git] / tools / env / fw_env.c
index 9b023e807bc446bebf10caf2864d92dbed8469b3..5be36fc35956b69d36f131fe3d99558f68b6d058 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <errno.h>
+#include <env_flags.h>
 #include <fcntl.h>
 #include <linux/stringify.h>
 #include <stdio.h>
@@ -395,6 +396,9 @@ int fw_setenv(int argc, char *argv[])
 
        name = argv[1];
 
+       if (env_flags_validate_env_set_params(argc, argv) < 0)
+               return 1;
+
        len = 0;
        for (i = 2; i < argc; ++i) {
                char *val = argv[i];
@@ -516,6 +520,11 @@ int fw_parse_script(char *fname)
                        name, val ? val : " removed");
 #endif
 
+               if (env_flags_validate_type(name, val) < 0) {
+                       ret = -1;
+                       break;
+               }
+
                /*
                 * If there is an error setting a variable,
                 * try to save the environment and returns an error