ruby-changes:50220
From: nobu <ko1@a...>
Date: Sat, 10 Feb 2018 10:07:08 +0900 (JST)
Subject: [ruby-changes:50220] nobu:r62338 (trunk): mjit.c: binary mode
nobu 2018-02-10 10:07:04 +0900 (Sat, 10 Feb 2018) New Revision: 62338 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62338 Log: mjit.c: binary mode * mjit.c (convert_unit_to_func): write source code in binary mode. not conversion is needed. Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 62337) +++ mjit.c (revision 62338) @@ -757,6 +757,11 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L757 int c_file_len = (int)sizeof(c_file_buff); static const char c_ext[] = ".c"; static const char so_ext[] = DLEXT; + const int access_mode = +#ifdef O_BINARY + O_BINARY| +#endif + O_WRONLY|O_EXCL|O_CREAT; c_file_len = sprint_uniq_filename(c_file_buff, c_file_len, unit->id, MJIT_TMP_PREFIX, c_ext); if (c_file_len >= (int)sizeof(c_file_buff)) { @@ -770,7 +775,7 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L775 memcpy(&so_file[c_file_len - sizeof(c_ext)], so_ext, sizeof(so_ext)); sprintf(funcname, "_mjit%d", unit->id); - fd = rb_cloexec_open(c_file, O_WRONLY|O_EXCL|O_CREAT, 0600); + fd = rb_cloexec_open(c_file, access_mode, 0600); if (fd < 0 || (f = fdopen(fd, "w")) == NULL) { int e = errno; if (fd >= 0) (void)close(fd); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/