aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/src
diff options
context:
space:
mode:
authorTom Rini <trini@embeddedalley.com>2008-12-08 01:02:00 -0700
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-08 20:45:47 +0200
commita8c858c45470aa6165acec2b2a3ca156124fdb2e (patch)
treef0b7752d5b30d59409b4ac57f77359fcf3ef35c3 /ubi-utils/new-utils/src
parentc7929b71e476729c38895de3db8c1afcfabf5352 (diff)
ubi-utils: various fixes
gcc-4.3.x introduces a number of new warnings (and we use -Werror) for things like not checking scanf return values and not using explicit formatting. Finally, it caught that we were overflowing our own buffer in unubi.c, so increate the variable size as we want to declare and clear PATH_MAX + 1, then use only PATH_MAX of the variable. Signed-off-by: Tom Rini <trini@embeddedalley.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils/src')
-rw-r--r--ubi-utils/new-utils/src/ubiformat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ubi-utils/new-utils/src/ubiformat.c b/ubi-utils/new-utils/src/ubiformat.c
index 05caed9..fb4f2ee 100644
--- a/ubi-utils/new-utils/src/ubiformat.c
+++ b/ubi-utils/new-utils/src/ubiformat.c
@@ -225,7 +225,10 @@ static int want_exit(void)
while (1) {
normsg_cont("continue? (yes/no) ");
- scanf("%3s", buf);
+ if (scanf("%3s", buf) == EOF) {
+ sys_errmsg("scanf returned unexpected EOF, assume \"yes\"");
+ return 1;
+ }
if (!strncmp(buf, "yes", 3) || !strncmp(buf, "y", 1))
return 0;
if (!strncmp(buf, "no", 2) || !strncmp(buf, "n", 1))
@@ -238,7 +241,10 @@ static int answer_is_yes(void)
char buf[4];
while (1) {
- scanf("%3s", buf);
+ if (scanf("%3s", buf) == EOF) {
+ sys_errmsg("scanf returned unexpected EOF, assume \"no\"");
+ return 0;
+ }
if (!strncmp(buf, "yes", 3) || !strncmp(buf, "y", 1))
return 1;
if (!strncmp(buf, "no", 2) || !strncmp(buf, "n", 1))