* environ.cc (enum settings): Add setbool. Rename justset to setdword
to avoid future problems. (struct parse_thing): Change all justset to setbool for bool variables. (parse_options): Add a case for setbool setting for bool variables since justset (now setdword) always writes a DWORD value, thus potentially overwriting adjacent memory locations. * external.cc (cygwin_internal): Drop extern declaration.
This commit is contained in:
parent
b0af77452c
commit
97ad248f0c
|
@ -1,3 +1,13 @@
|
|||
2012-02-26 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* environ.cc (enum settings): Add setbool. Rename justset to setdword
|
||||
to avoid future problems.
|
||||
(struct parse_thing): Change all justset to setbool for bool variables.
|
||||
(parse_options): Add a case for setbool setting for bool variables
|
||||
since justset (now setdword) always writes a DWORD value, thus
|
||||
potentially overwriting adjacent memory locations.
|
||||
* external.cc (cygwin_internal): Drop extern declaration.
|
||||
|
||||
2012-02-26 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* environ.cc (dos_file_warning): Drop declaration.
|
||||
|
|
|
@ -40,8 +40,9 @@ static NO_COPY bool export_settings = false;
|
|||
|
||||
enum settings
|
||||
{
|
||||
justset,
|
||||
isfunc,
|
||||
setdword,
|
||||
setbool,
|
||||
setbit
|
||||
};
|
||||
|
||||
|
@ -111,16 +112,16 @@ static struct parse_thing
|
|||
} values[2];
|
||||
} known[] NO_COPY =
|
||||
{
|
||||
{"detect_bloda", {&detect_bloda}, justset, NULL, {{false}, {true}}},
|
||||
{"dosfilewarning", {&dos_file_warning}, justset, NULL, {{false}, {true}}},
|
||||
{"detect_bloda", {&detect_bloda}, setbool, NULL, {{false}, {true}}},
|
||||
{"dosfilewarning", {&dos_file_warning}, setbool, NULL, {{false}, {true}}},
|
||||
{"error_start", {func: error_start_init}, isfunc, NULL, {{0}, {0}}},
|
||||
{"export", {&export_settings}, justset, NULL, {{false}, {true}}},
|
||||
{"export", {&export_settings}, setbool, NULL, {{false}, {true}}},
|
||||
{"glob", {func: glob_init}, isfunc, NULL, {{0}, {s: "normal"}}},
|
||||
{"proc_retry", {func: set_proc_retry}, isfunc, NULL, {{0}, {5}}},
|
||||
{"reset_com", {&reset_com}, justset, NULL, {{false}, {true}}},
|
||||
{"reset_com", {&reset_com}, setbool, NULL, {{false}, {true}}},
|
||||
{"tty", {func: tty_is_gone}, isfunc, NULL, {{0}, {0}}},
|
||||
{"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}},
|
||||
{NULL, {0}, justset, 0, {{0}, {0}}}
|
||||
{"winsymlinks", {&allow_winsymlinks}, setbool, NULL, {{false}, {true}}},
|
||||
{NULL, {0}, setdword, 0, {{0}, {0}}}
|
||||
};
|
||||
|
||||
/* Parse a string of the form "something=stuff somethingelse=more-stuff",
|
||||
|
@ -180,13 +181,20 @@ parse_options (const char *inbuf)
|
|||
k->values[istrue].s : eq);
|
||||
debug_printf ("%s (called func)", k->name);
|
||||
break;
|
||||
case justset:
|
||||
case setdword:
|
||||
if (!istrue || !eq)
|
||||
*k->setting.x = k->values[istrue].i;
|
||||
else
|
||||
*k->setting.x = strtol (eq, NULL, 0);
|
||||
debug_printf ("%s %d", k->name, *k->setting.x);
|
||||
break;
|
||||
case setbool:
|
||||
if (!istrue || !eq)
|
||||
*k->setting.b = k->values[istrue].i;
|
||||
else
|
||||
*k->setting.b = !!strtol (eq, NULL, 0);
|
||||
debug_printf ("%s%s", *k->setting.b ? "" : "no", k->name);
|
||||
break;
|
||||
case setbit:
|
||||
*k->setting.x &= ~k->values[istrue].i;
|
||||
if (istrue || (eq && strtol (eq, NULL, 0)))
|
||||
|
|
|
@ -432,7 +432,6 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
|||
break;
|
||||
case CW_SET_DOS_FILE_WARNING:
|
||||
{
|
||||
extern bool dos_file_warning;
|
||||
dos_file_warning = va_arg (arg, int);
|
||||
res = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue