From 9320b5c65ff0f51d8fdc74d70476db70e40231e7 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 26 Sep 2008 18:57:23 +0000 Subject: * file.c (rmext): preceding dots are not a part of extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index 62155faf53..e16f4a83bc 100644 --- a/file.c +++ b/file.c @@ -2955,16 +2955,19 @@ rb_file_s_absolute_path(int argc, VALUE *argv) static int rmext(const char *p, int l1, const char *e) { - int l2; + int l0, l2; if (!e) return 0; + for (l0 = 0; l0 < l1; ++l0) { + if (p[l0] != '.') break; + } l2 = strlen(e); if (l2 == 2 && e[1] == '*') { unsigned char c = *e; e = p + l1; do { - if (e <= p) return 0; + if (e <= p + l0) return 0; } while (*--e != c); return e - p; } -- cgit v1.2.3