浏览代码

Fixed smb driver Close crashing issue

Toby Chui 3 年之前
父节点
当前提交
939ca0ef4c
共有 4 个文件被更改,包括 8 次插入1 次删除
  1. 3 0
      mod/filesystem/filesystem.go
  2. 1 1
      quota.go
  3. 4 0
      storage.go
  4. 0 0
      web/SystemAO/disk/quota/quota.html

+ 3 - 0
mod/filesystem/filesystem.go

@@ -356,6 +356,9 @@ func (fsh *FileSystemHandler) DeleteFileRecord(rpath string) error {
 
 //Close an openeded File System
 func (fsh *FileSystemHandler) Close() {
+	//Set the close flag to true so others function wont access it
+	fsh.Closed = true
+
 	//Close the fsh database
 	if fsh.FilesystemDatabase != nil {
 		fsh.FilesystemDatabase.Close()

+ 1 - 1
quota.go

@@ -26,7 +26,7 @@ func DiskQuotaInit() {
 		Desc:     "User Remaining Space",
 		IconPath: "SystemAO/disk/quota/img/small_icon.png",
 		Group:    "Disk",
-		StartDir: "SystemAO/disk/quota/quota.system",
+		StartDir: "SystemAO/disk/quota/quota.html",
 	})
 
 	//Register the timer for running the global user quota recalculation

+ 4 - 0
storage.go

@@ -225,6 +225,10 @@ func GetFSHandlerSubpathFromVpath(vpath string) (*fs.FileSystemHandler, string,
 		return nil, "", errors.New("Unable to resolve requested path: " + err.Error())
 	}
 
+	if fsh.Closed {
+		return nil, "", errors.New("Target file system handler already closed")
+	}
+
 	return fsh, subpath, nil
 }
 

+ 0 - 0
web/SystemAO/disk/quota/quota.system → web/SystemAO/disk/quota/quota.html