ape: add some common fields for stat, grp and pwd
This commit is contained in:
parent
0763dd4279
commit
583c6d269b
8 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
struct group {
|
||||
char *gr_name;
|
||||
char *gr_passwd;
|
||||
gid_t gr_gid;
|
||||
char **gr_mem;
|
||||
};
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
|
||||
struct passwd {
|
||||
char *pw_name;
|
||||
char *pw_passwd;
|
||||
uid_t pw_uid;
|
||||
gid_t pw_gid;
|
||||
char *pw_gecos;
|
||||
char *pw_dir;
|
||||
char *pw_shell;
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ struct stat {
|
|||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
off_t st_size;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
|
|
|
@ -27,6 +27,7 @@ _dirtostat(struct stat *s, Dir *d, Fdinfo *fi)
|
|||
s->st_nlink = 1;
|
||||
s->st_uid = 1;
|
||||
s->st_gid = 1;
|
||||
s->st_rdev = 0;
|
||||
if(fi && (fi->flags&FD_BUFFERED))
|
||||
s->st_size = fi->buf->n;
|
||||
else
|
||||
|
|
|
@ -17,6 +17,7 @@ getgrgid(gid_t gid)
|
|||
mem = 0;
|
||||
if(_getpw(&num, &nam, &mem)){
|
||||
holdgroup.gr_name = nam;
|
||||
holdgroup.gr_passwd = "";
|
||||
holdgroup.gr_gid = num;
|
||||
holdgroup.gr_mem = _grpmems(mem);
|
||||
return &holdgroup;
|
||||
|
|
|
@ -17,6 +17,7 @@ getgrnam(const char *name)
|
|||
mem = 0;
|
||||
if(_getpw(&num, &nam, &mem)){
|
||||
holdgroup.gr_name = nam;
|
||||
holdgroup.gr_passwd = "";
|
||||
holdgroup.gr_gid = num;
|
||||
holdgroup.gr_mem = _grpmems(mem);
|
||||
return &holdgroup;
|
||||
|
|
|
@ -18,10 +18,12 @@ getpwnam(const char *name)
|
|||
mem = 0;
|
||||
if(_getpw(&num, &nam, &mem)){
|
||||
holdpw.pw_name = nam;
|
||||
holdpw.pw_passwd = "";
|
||||
holdpw.pw_uid = num;
|
||||
holdpw.pw_gid = num;
|
||||
strncpy(dirbuf+5, nam, sizeof(dirbuf)-6);
|
||||
holdpw.pw_dir = dirbuf;
|
||||
holdpw.pw_gecos = "";
|
||||
holdpw.pw_shell = rc;
|
||||
return &holdpw;
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@ getpwuid(uid_t uid)
|
|||
mem = 0;
|
||||
if(_getpw(&num, &nam, &mem)){
|
||||
holdpw.pw_name = nam;
|
||||
holdpw.pw_passwd = "";
|
||||
holdpw.pw_uid = num;
|
||||
holdpw.pw_gid = num;
|
||||
strncpy(dirbuf+5, nam, sizeof(dirbuf)-6);
|
||||
holdpw.pw_dir = dirbuf;
|
||||
holdpw.pw_gecos = "";
|
||||
holdpw.pw_shell = rc;
|
||||
return &holdpw;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue