summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--io.c14
-rw-r--r--version.h4
3 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 86785dbecc..23d91f41b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 23 06:42:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_next_argv): check for setting owner/group.
+
Tue Jun 22 23:10:10 2010 Tanaka Akira <akr@fsij.org>
* time.c (num_exact): fix for mathn. [ruby-dev:41599]
diff --git a/io.c b/io.c
index d231e1317c..68f6a96522 100644
--- a/io.c
+++ b/io.c
@@ -6818,11 +6818,21 @@ argf_next_argv(VALUE argf)
chmod(fn, st.st_mode);
#endif
if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
+ int err;
#ifdef HAVE_FCHOWN
- (void)fchown(fw, st.st_uid, st.st_gid);
+ err = fchown(fw, st.st_uid, st.st_gid);
#else
- (void)chown(fn, st.st_uid, st.st_gid);
+ err = chown(fn, st.st_uid, st.st_gid);
#endif
+ if (err && getuid() == 0 && st2.st_uid == 0) {
+ const char *wkfn = RSTRING_PTR(ARGF.filename);
+ rb_warn("Can't set owner/group of %s to same as %s: %s, skipping file",
+ wkfn, fn, strerror(errno));
+ (void)close(fr);
+ (void)close(fw);
+ (void)unlink(wkfn);
+ goto retry;
+ }
}
#endif
rb_stdout = prep_io(fw, FMODE_WRITABLE, rb_cFile, fn);
diff --git a/version.h b/version.h
index 2209aced93..5ea41f281b 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_RELEASE_DATE "2010-06-22"
+#define RUBY_RELEASE_DATE "2010-06-23"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
@@ -8,7 +8,7 @@
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2010
#define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 22
+#define RUBY_RELEASE_DAY 23
#include "ruby/version.h"