[macruby-changes] [2711] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Sun Oct 4 13:22:06 PDT 2009
Revision: 2711
http://trac.macosforge.org/projects/ruby/changeset/2711
Author: lsansonetti at apple.com
Date: 2009-10-04 13:22:02 -0700 (Sun, 04 Oct 2009)
Log Message:
-----------
File.open: take into account given permissions
Modified Paths:
--------------
MacRuby/trunk/TODO
MacRuby/trunk/io.c
Modified: MacRuby/trunk/TODO
===================================================================
--- MacRuby/trunk/TODO 2009-10-04 19:42:49 UTC (rev 2710)
+++ MacRuby/trunk/TODO 2009-10-04 20:22:02 UTC (rev 2711)
@@ -12,7 +12,7 @@
[X] `gem uninstall bacon' doesn't work (Unknown gem bacon >= 0)
[X] `macgem install rails --version 2.3.2' crashes (MAX_DISPATCH_ARGS assertion)
[X] `macgem help commands' crashes
- [ ] gem installed executables are not executables
+ [X] gem installed executables are not executables
[X] rewrite load.c (needed for RubyGems' #require hack)
For 0.5 (must do):
Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c 2009-10-04 19:42:49 UTC (rev 2710)
+++ MacRuby/trunk/io.c 2009-10-04 20:22:02 UTC (rev 2711)
@@ -2246,7 +2246,6 @@
static VALUE
rb_file_open(VALUE io, int argc, VALUE *argv)
{
- // TODO: Take into account the provided file permissions.
VALUE path, modes, permissions;
rb_scan_args(argc, argv, "12", &path, &modes, &permissions);
if (NIL_P(modes)) {
@@ -2255,9 +2254,10 @@
StringValue(path);
const char *filepath = RSTRING_PTR(path);
const int flags = convert_mode_string_to_oflags(modes);
+ const mode_t perm = NIL_P(permissions) ? 0666 : NUM2UINT(permissions);
int fd, retry = 0;
while (true) {
- fd = open(filepath, flags, 0644);
+ fd = open(filepath, flags, perm);
if (fd == -1) {
if (retry < 5 && errno == EMFILE) {
// Too many open files. Let's schedule a GC collection.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091004/791fdbd4/attachment.html>
More information about the macruby-changes
mailing list