summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index a38a5f1f68..19879859fc 100644
--- a/ruby.c
+++ b/ruby.c
@@ -266,11 +266,12 @@ process_sflag()
n = RARRAY(rb_argv)->len;
args = RARRAY(rb_argv)->ptr;
- while (n--) {
- char *s = STR2CSTR(*args);
+ while (n > 0) {
+ char *s = STR2CSTR(*args++);
char *p;
- if (s[0] != '-') continue;
+ if (s[0] != '-') break;
+ n--;
if (s[1] == '-' && s[2] == '\0') break;
s[0] = '$';