зеркало из https://github.com/github/ruby.git
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
dd7a195a21
Коммит
0535fc9cac
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Fri Nov 11 07:39:49 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]
|
||||
|
||||
Thu Nov 10 21:05:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/shellwords.rb: fix for blank but not empty string.
|
||||
|
|
|
@ -346,7 +346,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
|
||||
|
|
27
file.c
27
file.c
|
@ -64,6 +64,33 @@ VALUE rb_time_new(time_t, time_t);
|
|||
#define lstat stat
|
||||
#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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче