summaryrefslogtreecommitdiffstats
path: root/api/api.c
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* api: remove un-needed ifdef CONFIG_API already handle by the MakefileJean-Christophe PLAGNIOL-VILLARD2009-05-151-5/+0
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* rename CFG_ENV macros to CONFIG_ENVJean-Christophe PLAGNIOL-VILLARD2008-09-101-1/+1
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* environment: cleanup prototype declarations of env functions.Wolfgang Denk2008-05-141-2/+1
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Revert "Change env_get_char from a global function ptr to a function."Wolfgang Denk2008-05-121-0/+1
| | | | | This reverts commit c0559be371b2a64b1a817088c3308688e2182f93 which is known to break booting from dataflash and NAND.
* API: remove duplicate syscall checkJean-Christophe PLAGNIOL-VILLARD2008-05-121-1/+1
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Change env_get_char from a global function ptr to a function.Joakim Tjernlund2008-04-171-1/+0
| | | | | | This avoids an early global data reference. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
* Coding Style cleanup; update CHANGELOGWolfgang Denk2008-01-101-6/+6
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* API for external applications.Rafal Jaworowski2008-01-091-0/+670
This is an API for external (standalone) applications running on top of U-Boot, and is meant to be more extensible and robust than the existing jumptable mechanism. It is similar to UNIX syscall approach. See api/README for more details. Included is the demo application using this new framework (api_examples). Please note this is still an experimental feature, and is turned off by default. Signed-off-by: Rafal Jaworowski <raj@semihalf.com>
OpenPOWER on IntegriCloud