diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -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 } /* |