Index: appfsd.tcl ================================================================== --- appfsd.tcl +++ appfsd.tcl @@ -607,23 +607,30 @@ set localcachefile [download $pathinfo(hostname) $pkgpathinfo(file_sha1)] if {$mode == "write"} { set tmplocalpath "${localpath}.[expr rand()][clock clicks]" - catch { + set failed 0 + if {[catch { file mkdir [file dirname $localpath] file copy -force -- $localcachefile $tmplocalpath if {$pkgpathinfo(perms) == "x"} { file attributes $tmplocalpath -permissions +x } file rename -force -- $tmplocalpath $localpath + } err]} { + set failed 1 } catch { file delete -force -- $tmplocalpath } + + if {$failed} { + return -code error $err + } return $localpath } return $localcachefile