Import changes from lib9p repo:

- Integrate (slightly modified) pull request #1 from ailispaw.
  (https://github.com/jceel/xhyve/pull/1)
- Populate file->gid from parent fid.
This commit is contained in:
Jakub Klama 2016-02-03 10:05:24 +01:00
parent d689226627
commit bf49b0e5f5

View file

@ -536,9 +536,16 @@ fs_remove(void *softc, struct l9p_request *req)
return;
}
if (unlink(file->name) != 0) {
l9p_respond(req, errno);
return;
if (S_ISDIR(st.st_mode)) {
if (rmdir(file->name) != 0) {
l9p_respond(req, errno);
return;
}
} else {
if (unlink(file->name) != 0) {
l9p_respond(req, errno);
return;
}
}
l9p_respond(req, 0);
@ -584,6 +591,7 @@ fs_walk(void *softc __unused, struct l9p_request *req)
newfile = open_fid(name);
newfile->uid = file->uid;
newfile->gid = file->gid;
req->lr_newfid->lo_aux = newfile;
req->lr_resp.rwalk.nwqid = i;
l9p_respond(req, 0);
@ -682,15 +690,8 @@ fs_wstat(void *softc, struct l9p_request *req)
}
}
if (l9stat->n_uid != (uid_t)~0) {
if (lchown(file->name, l9stat->n_uid, (gid_t)-1) != 0) {
l9p_respond(req, errno);
return;
}
}
if (l9stat->n_gid != (uid_t)~0) {
if (lchown(file->name, (uid_t)-1, l9stat->n_gid) != 0) {
if (req->lr_conn->lc_version >= L9P_2000U) {
if (lchown(file->name, l9stat->n_uid, l9stat->n_gid) != 0) {
l9p_respond(req, errno);
return;
}