summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-05 10:21:22 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-05 10:21:22 +0000
commite58ec3372190b0f9e294351a4e1ca603da01ca72 (patch)
tree77f96e3934ec787fe621cdc95ef689c80db24e60 /process.c
parent5b13036fce91d8970448e565e4319939b27cdc00 (diff)
* process.c (rb_exec_fillarg): bail out a loop eagerly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/process.c b/process.c
index acd7834671..90d828eb8f 100644
--- a/process.c
+++ b/process.c
@@ -1805,10 +1805,12 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, str
int has_meta = 0;
int has_nonspace = 0;
for (p = RSTRING_PTR(prog); *p; p++) {
- if (*p != ' ' && *p != '\t')
+ if (!has_nonspace && *p != ' ' && *p != '\t')
has_nonspace = 1;
- if (strchr("*?{}[]<>()~&|\\$;'`\"\n", *p))
+ if (!has_meta && strchr("*?{}[]<>()~&|\\$;'`\"\n", *p))
has_meta = 1;
+ if (has_nonspace && has_meta)
+ break;
}
if (has_nonspace && !has_meta) {
/* avoid shell since no shell meta charactor found. */