summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-27 08:54:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-27 08:54:49 +0000
commit4bc2ac33ca53e3e956bca2f79e17d853bdcce0a8 (patch)
treec52d811de9de4967ff1344f32bd46f4bd870ae2e /file.c
parentb5bbcb253b2d6ae6032b7e2b8e00aff8ed01e698 (diff)
* eval.c (rb_eval): add CHECK_INTS before next, redo, retry to
avoid potential uninterruptable infinite loop. * file.c (rb_file_s_expand_path): should not expand "." and ".." not following dirsep. * eval.c (rb_provide_feature): should not tweak extension used for loading. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/file.c b/file.c
index a47980f695..3b4541a57f 100644
--- a/file.c
+++ b/file.c
@@ -1224,7 +1224,7 @@ rb_file_s_expand_path(argc, argv)
VALUE *argv;
{
VALUE fname, dname;
- char *s, *p;
+ char *s, *p, *sbeg;
char buf[MAXPATHLEN+2];
char *bend = buf + sizeof(buf) - 2;
int tainted;
@@ -1232,7 +1232,7 @@ rb_file_s_expand_path(argc, argv)
rb_scan_args(argc, argv, "11", &fname, &dname);
tainted = OBJ_TAINTED(fname);
- s = STR2CSTR(fname);
+ sbeg = s = STR2CSTR(fname);
p = buf;
if (s[0] == '~') {
if (isdirsep(s[1]) || s[1] == '\0') {
@@ -1310,7 +1310,7 @@ rb_file_s_expand_path(argc, argv)
for ( ; *s; s++) {
switch (*s) {
case '.':
- if (*(s+1)) {
+ if (*(s+1) && (s == sbeg || isdirsep(*(s - 1)))) {
switch (*++s) {
case '.':
if (*(s+1) == '\0' || isdirsep(*(s+1))) {
@@ -1336,6 +1336,9 @@ rb_file_s_expand_path(argc, argv)
default:
*++p = '.'; *++p = *s; break;
}
+ }
+ else {
+ *++p = '.';
}
break;
case '/':