Skip to content

Commit

Permalink
mknod fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Oct 8, 2024
1 parent 9b48030 commit e2a45d9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/9p-filer.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,24 @@ Virtio9p.prototype.ReceiveRequest = async function(bufchain) {
var major = req[3];
var minor = req[4];
var gid = req[5];
message.Debug("[mknod] fid=" + fid + ", name=" + name + ", major=" + major + ", minor=" + minor + "");
console.log("[mknod] fid=" + fid + ", name=" + name + ", major=" + major + ", minor=" + minor + "");

// TODO: deal with mode properly in filer
fs.mknod(filePath, "FILE", function(err) {
var fullpath = Path.join(filePath, name);
fs.appendFile(fullpath, null, function(err) {
if(self.shouldAbortRequest(tag)) return;

if(err) {
console.log("MKNOD ERROR: ", err)
self.SendError(tag, err);
self.SendReply(bufchain);
return;
}
fs.stat(filePath, function(err, stats) {
fs.stat(fullpath, function(err, stats) {
if(self.shouldAbortRequest(tag)) return;

if(err) {
console.log("MKNOD STAT ERROR: ", err);
self.SendError(tag, err);
self.SendReply(bufchain);
return;
Expand Down Expand Up @@ -1227,7 +1230,7 @@ Virtio9p.prototype.ReceiveRequest = async function(bufchain) {
data.set(dat, 0);

if(err) {
console.err(err);
console.error(err);
delete self.fids[fid];
this.BuildReply(id, tag, 0);
this.SendReply(bufchain);
Expand Down

0 comments on commit e2a45d9

Please sign in to comment.