diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-10 22:48:43 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-10 22:48:43 +0000 |
commit | fa9a6a96e112313868f4b8623a7bdf2a5c7181d1 (patch) | |
tree | 9ba558cd06e443d82d42d53d9a1fbc58aa679900 | |
parent | dad44811e2235abd7db463f0ef0bbf5372265187 (diff) |
* configure.in: undef HAVE_LINK on BeOS. (link(2) always returns
EINVAL, and this causes error in test/fileutils.)
* file.c: overwride chown(2) and fchown(2) on BeOS. (these functions
should not change user/group id if -1 is passed as corresponding
argument, and this causes error in test/fileutils too)
[ruby-dev:27672]
* file.c (rb_file_s_link): checks HAVE_LINK.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | file.c | 32 |
3 files changed, 45 insertions, 1 deletions
@@ -1,3 +1,15 @@ +Fri Nov 11 07:44:18 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> + + * configure.in: undef HAVE_LINK on BeOS. (link(2) always returns + EINVAL, and this causes error in test/fileutils.) + + * file.c: overwride chown(2) and fchown(2) on BeOS. (these functions + should not change user/group id if -1 is passed as corresponding + argument, and this causes error in test/fileutils too) + [ruby-dev:27672] + + * file.c (rb_file_s_link): checks HAVE_LINK. + Tue Nov 8 15:32:27 2005 GOTOU Yuuzou <gotoyuzo@notwork.org> * lib/drb/ssl.rb (DRb::SSLConfig#accept): fixed typo. diff --git a/configure.in b/configure.in index 40dfdbc581..42b5645c17 100644 --- a/configure.in +++ b/configure.in @@ -321,7 +321,7 @@ hpux*) LIBS="-lm $LIBS" human*) ac_cv_func_getpgrp_void=yes ac_cv_func_setitimer=no ;; -beos*) ;; +beos*) ac_cv_func_link=no;; cygwin*) rb_cv_have_daylight=no ac_cv_var_tzname=no ac_cv_func__setjmp=no @@ -71,6 +71,33 @@ char *strrchr _((const char*,const char)); # define fseeko fseek #endif +#ifdef __BEOS__ /* should not change ID if -1 */ +static int +be_chown(const char *path, uid_t owner, gid_t group) +{ + if (owner == -1 || group == -1) { + struct stat st; + if (stat(path, &st) < 0) return -1; + if (owner == -1) owner = st.st_uid; + if (group == -1) group = st.st_gid; + } + return chown(path, owner, group); +} +#define chown be_chown +static int +be_fchown(int fd, uid_t owner, gid_t group) +{ + if (owner == -1 || group == -1) { + struct stat st; + if (fstat(fd, &st) < 0) return -1; + if (owner == -1) owner = st.st_uid; + if (group == -1) group = st.st_gid; + } + return fchown(fd, owner, group); +} +#define fchown be_fchown +#endif /* __BEOS__ */ + VALUE rb_cFile; VALUE rb_mFileTest; static VALUE rb_cStat; @@ -1957,6 +1984,7 @@ static VALUE rb_file_s_link(klass, from, to) VALUE klass, from, to; { +#ifdef HAVE_LINK SafeStringValue(from); SafeStringValue(to); @@ -1964,6 +1992,10 @@ rb_file_s_link(klass, from, to) sys_fail2(from, to); } return INT2FIX(0); +#else + rb_notimplement(); + return Qnil; /* not reached */ +#endif } /* |