зеркало из https://github.com/github/ruby.git
* file.c (be_chown, be_fchown, eaccess): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
57d4faec1b
Коммит
54e45b30cc
14
file.c
14
file.c
|
@ -74,11 +74,11 @@ int flock(int, int);
|
|||
static int
|
||||
be_chown(const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
if (owner == -1 || group == -1) {
|
||||
if (owner == (uid_t)-1 || group == (gid_t)-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;
|
||||
if (owner == (uid_t)-1) owner = st.st_uid;
|
||||
if (group == (gid_t)-1) group = st.st_gid;
|
||||
}
|
||||
return chown(path, owner, group);
|
||||
}
|
||||
|
@ -86,11 +86,11 @@ be_chown(const char *path, uid_t owner, gid_t group)
|
|||
static int
|
||||
be_fchown(int fd, uid_t owner, gid_t group)
|
||||
{
|
||||
if (owner == -1 || group == -1) {
|
||||
if (owner == (uid_t)-1 || group == (gid_t)-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;
|
||||
if (owner == (uid_t)-1) owner = st.st_uid;
|
||||
if (group == (gid_t)-1) group = st.st_gid;
|
||||
}
|
||||
return fchown(fd, owner, group);
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ eaccess(const char *path, int mode)
|
|||
else if (group_member(st.st_gid))
|
||||
mode <<= 3;
|
||||
|
||||
if ((st.st_mode & mode) == mode) return 0;
|
||||
if ((int)(st.st_mode & mode) == mode) return 0;
|
||||
|
||||
return -1;
|
||||
#else
|
||||
|
|
Загрузка…
Ссылка в новой задаче