summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-02-26 15:47:43 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-02-26 15:47:43 +0000
commit97ad248f0cbd87cb1e351961b632bf9764f608fe (patch)
tree5f9415bd848801a9961cca01c16be3336855bc1a
parentb0af77452cad7e92c10ff095cc4a25a5133c03ab (diff)
downloadcygnal-97ad248f0cbd87cb1e351961b632bf9764f608fe.tar.gz
cygnal-97ad248f0cbd87cb1e351961b632bf9764f608fe.tar.bz2
cygnal-97ad248f0cbd87cb1e351961b632bf9764f608fe.zip
* 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.
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/environ.cc24
-rw-r--r--winsup/cygwin/external.cc1
3 files changed, 26 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 48a5c5e84..e4ddbb744 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,15 @@
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.
(ignore_case_with_glob): Ditto.
(allow_winsymlinks): Ditto.
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index a99f97cf8..33289d2f5 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -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)))
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index 146dda953..cd86966b8 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -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;
}