Fixes for problems identified in review of review
* Handle case where no console should be used at all * Better handling of buffer length compiler warnings BugzId: 66150
This commit is contained in:
parent
2e581d5211
commit
96716293f1
|
|
@ -29,12 +29,16 @@ void set_console(void)
|
||||||
read_file_set_blk_dev("mmc", "0:3", FS_TYPE_EXT);
|
read_file_set_blk_dev("mmc", "0:3", FS_TYPE_EXT);
|
||||||
|
|
||||||
len = get_file_size(consolefile);
|
len = get_file_size(consolefile);
|
||||||
if (len>=5) {
|
memset(buf, 0x00, sizeof(buf));
|
||||||
memset(buf, 0x00, sizeof(buf));
|
if (len>=4) {
|
||||||
read_file(consolefile, buf, sizeof(buf)-1);
|
read_file(consolefile, buf, sizeof(buf)-1);
|
||||||
if (strstr(buf, "ttyS") == buf && ( buf[4] == '0' || buf[4] == '1' )) {
|
if (strstr(buf, "ttyS") == buf && ( buf[4] == '0' || buf[4] == '1' )) {
|
||||||
/* Use retrieved ttySx */
|
/* Use retrieved ttySx */
|
||||||
use_default_console = 0;
|
use_default_console = 0;
|
||||||
|
} else if (strstr(buf, "none")==buf) {
|
||||||
|
/* disable console */
|
||||||
|
buf[0] = 0;
|
||||||
|
use_default_console = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -743,7 +743,7 @@ int conf_write(const char *name)
|
||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
const char *basename;
|
const char *basename;
|
||||||
const char *str;
|
const char *str;
|
||||||
char dirname[PATH_MAX+1], tmpname[PATH_MAX+14], newname[PATH_MAX+8];
|
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
|
||||||
char *env;
|
char *env;
|
||||||
|
|
||||||
dirname[0] = 0;
|
dirname[0] = 0;
|
||||||
|
|
@ -768,10 +768,10 @@ int conf_write(const char *name)
|
||||||
} else
|
} else
|
||||||
basename = conf_get_configname();
|
basename = conf_get_configname();
|
||||||
|
|
||||||
sprintf(newname, "%s%s", dirname, basename);
|
snprintf(newname, sizeof(newname), "%s%s", dirname, basename);
|
||||||
env = getenv("KCONFIG_OVERWRITECONFIG");
|
env = getenv("KCONFIG_OVERWRITECONFIG");
|
||||||
if (!env || !*env) {
|
if (!env || !*env) {
|
||||||
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
|
snprintf(tmpname, sizeof(tmpname), "%s.tmpconfig.%d", dirname, (int)getpid());
|
||||||
out = fopen(tmpname, "w");
|
out = fopen(tmpname, "w");
|
||||||
} else {
|
} else {
|
||||||
*tmpname = 0;
|
*tmpname = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue