summaryrefslogtreecommitdiff
path: root/nand-utils/load_nandsim.sh
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-09-19 10:57:34 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-09-20 11:27:01 +0200
commit38a6e3e29d90e11c3d5147e609d7b8e021b2cabf (patch)
tree8ba5cf8d7df5bde31ff2b4f1287b9f3b8feffc78 /nand-utils/load_nandsim.sh
parenta63a209d8ee8f21722a3b07d01d904bca5dbbc31 (diff)
mtd-utils: common.h: fix prompt function
The prompt() function is intended to query a yes/no reply from a command line user by reading in an entire line of text using getline() and checking the first character. If the line is empty, a default value is returned. First of all, this patch replaces the usage of getline() with fgets() to avoid compilation problems on some smaller C libraries, like klibc, that do not have a getline() implementation. Since we now have a static line length, this may break some build setups that input lengthy giberish instead of 'y' or 'n'. Second, this patch fixes a more severe bug in prompt(), replacing a 'while' keyword with the 'if' that was most likely intended. In the old version, if getline() reported an error, it would print an error message inside a while loop, immediately followed by a break and then march on and process the erroneous input instead of using the default value as printed to stdout. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'nand-utils/load_nandsim.sh')
0 files changed, 0 insertions, 0 deletions