summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-17 08:27:39 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-17 08:27:39 +0000
commit406a08c4d7937255d9aa01c7a7144125fc8c0dee (patch)
tree8dd7e35f421f3e410d1cc405a7dc2c49fa83dad9 /ruby.c
parent2aab471a2c4d76ab8decbdc04d7fd8e1fd82c2e8 (diff)
merge revision(s) 64900: [Backport #15190]
Just a shebang is valid code [ruby-core:89240] [Bug #15190] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/ruby.c b/ruby.c
index 1e2579c556..7ed4752b6e 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1798,11 +1798,7 @@ load_file_internal(VALUE argp_v)
c = rb_io_getbyte(f);
if (c == INT2FIX('#')) {
c = rb_io_getbyte(f);
- if (c == INT2FIX('!')) {
- line = rb_io_gets(f);
- if (NIL_P(line))
- return 0;
-
+ if (c == INT2FIX('!') && !NIL_P(line = rb_io_gets(f))) {
RSTRING_GETMEM(line, str, len);
warn_cr_in_shebang(str, len);
if ((p = strstr(str, ruby_engine)) == 0) {