summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-23 11:47:02 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-23 11:47:02 +0000
commitee8c98e5ccdc6a421d52652ae560f2efcb850749 (patch)
treeae74fac903089ee809a09f2b0c450d10283af4a7 /win32
parentc2086cc7ff1142b14c95c8758af24b8689b78ffc (diff)
* win32/win32.c (szInternalCmds, internal_match, internal_cmd_match):
get rid of a segmentation fault with GCC 4.7.0. reported by raylinn@gmail.com (ray linn) at [ruby-core:44505] [Bug #6333], and patched by mame. * test/ruby/test_system.rb (TestSystem#test_system): test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 687d8bd04a..7cbbaa2183 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -844,62 +844,62 @@ FindFreeChildSlot(void)
98cmd ntcmd
*/
static const char *const szInternalCmds[] = {
- "\2" "assoc" + 1,
- "\3" "break" + 1,
- "\3" "call" + 1,
- "\3" "cd" + 1,
- "\1" "chcp" + 1,
- "\3" "chdir" + 1,
- "\3" "cls" + 1,
- "\2" "color" + 1,
- "\3" "copy" + 1,
- "\1" "ctty" + 1,
- "\3" "date" + 1,
- "\3" "del" + 1,
- "\3" "dir" + 1,
- "\3" "echo" + 1,
- "\2" "endlocal" + 1,
- "\3" "erase" + 1,
- "\3" "exit" + 1,
- "\3" "for" + 1,
- "\2" "ftype" + 1,
- "\3" "goto" + 1,
- "\3" "if" + 1,
- "\1" "lfnfor" + 1,
- "\1" "lh" + 1,
- "\1" "lock" + 1,
- "\3" "md" + 1,
- "\3" "mkdir" + 1,
- "\2" "move" + 1,
- "\3" "path" + 1,
- "\3" "pause" + 1,
- "\2" "popd" + 1,
- "\3" "prompt" + 1,
- "\2" "pushd" + 1,
- "\3" "rd" + 1,
- "\3" "rem" + 1,
- "\3" "ren" + 1,
- "\3" "rename" + 1,
- "\3" "rmdir" + 1,
- "\3" "set" + 1,
- "\2" "setlocal" + 1,
- "\3" "shift" + 1,
- "\2" "start" + 1,
- "\3" "time" + 1,
- "\2" "title" + 1,
- "\1" "truename" + 1,
- "\3" "type" + 1,
- "\1" "unlock" + 1,
- "\3" "ver" + 1,
- "\3" "verify" + 1,
- "\3" "vol" + 1,
+ "\2" "assoc",
+ "\3" "break",
+ "\3" "call",
+ "\3" "cd",
+ "\1" "chcp",
+ "\3" "chdir",
+ "\3" "cls",
+ "\2" "color",
+ "\3" "copy",
+ "\1" "ctty",
+ "\3" "date",
+ "\3" "del",
+ "\3" "dir",
+ "\3" "echo",
+ "\2" "endlocal",
+ "\3" "erase",
+ "\3" "exit",
+ "\3" "for",
+ "\2" "ftype",
+ "\3" "goto",
+ "\3" "if",
+ "\1" "lfnfor",
+ "\1" "lh",
+ "\1" "lock",
+ "\3" "md",
+ "\3" "mkdir",
+ "\2" "move",
+ "\3" "path",
+ "\3" "pause",
+ "\2" "popd",
+ "\3" "prompt",
+ "\2" "pushd",
+ "\3" "rd",
+ "\3" "rem",
+ "\3" "ren",
+ "\3" "rename",
+ "\3" "rmdir",
+ "\3" "set",
+ "\2" "setlocal",
+ "\3" "shift",
+ "\2" "start",
+ "\3" "time",
+ "\2" "title",
+ "\1" "truename",
+ "\3" "type",
+ "\1" "unlock",
+ "\3" "ver",
+ "\3" "verify",
+ "\3" "vol",
};
/* License: Ruby's */
static int
internal_match(const void *key, const void *elem)
{
- return strcmp(key, *(const char *const *)elem);
+ return strcmp(key, (*(const char *const *)elem) + 1);
}
/* License: Ruby's */
@@ -956,7 +956,7 @@ internal_cmd_match(const char *cmdname, int nt)
sizeof(szInternalCmds) / sizeof(*szInternalCmds),
sizeof(*szInternalCmds),
internal_match);
- if (!nm || !(nm[0][-1] & (nt ? 2 : 1)))
+ if (!nm || !(nm[0][0] & (nt ? 2 : 1)))
return 0;
return 1;
}