Skip to content

Commit

Permalink
9pfs: set S_IFREG for regular files (fix Invalid argument on linux 6.…
Browse files Browse the repository at this point in the history
…6+, fix #996)
  • Loading branch information
copy committed Apr 23, 2024
1 parent 09678e0 commit 2ca82a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/9p.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ Virtio9p.prototype.ReceiveRequest = async function (bufchain) {
var idx = this.fs.CreateNode(name, this.fids[fid].inodeid, major, minor);
var inode = this.fs.GetInode(idx);
inode.mode = mode;
//inode.mode = mode | S_IFCHR; // XXX: fails "Mknod - fifo" test
inode.uid = this.fids[fid].uid;
inode.gid = gid;
marshall.Marshall(["Q"], [inode.qid], this.replybuffer, 7);
Expand Down Expand Up @@ -415,7 +416,7 @@ Virtio9p.prototype.ReceiveRequest = async function (bufchain) {
var inode = this.fs.GetInode(idx);
inode.uid = this.fids[fid].uid;
inode.gid = gid;
inode.mode = mode;
inode.mode = mode | S_IFREG;
marshall.Marshall(["Q", "w"], [inode.qid, this.msize - 24], this.replybuffer, 7);
this.BuildReply(id, tag, 13+4);
this.SendReply(bufchain);
Expand Down Expand Up @@ -529,6 +530,7 @@ Virtio9p.prototype.ReceiveRequest = async function (bufchain) {
var inode = this.fs.GetInode(this.fids[fid].inodeid);
message.Debug("[setattr]: fid=" + fid + " request mask=" + req[1] + " name=" + this.fids[fid].dbg_name);
if (req[1] & P9_SETATTR_MODE) {
// XXX: check mode (S_IFREG or S_IFDIR or similar should be set)
inode.mode = req[2];
}
if (req[1] & P9_SETATTR_UID) {
Expand Down

0 comments on commit 2ca82a5

Please sign in to comment.