diff options
Diffstat (limited to 'generic/tclIOUtil.c')
| -rw-r--r-- | generic/tclIOUtil.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 7bbb9cd..c74eb00 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -4315,11 +4315,17 @@ Tcl_FSDeleteFile( Tcl_Obj *pathPtr) /* Pathname of file to be removed (UTF-8). */ { const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); - - if (fsPtr != NULL && fsPtr->deleteFileProc != NULL) { - return fsPtr->deleteFileProc(pathPtr); + int err; + + if (fsPtr == NULL) { + err = ENOENT; + } else { + if (fsPtr->deleteFileProc != NULL) { + return fsPtr->deleteFileProc(pathPtr); + } + err = ENOTSUP; } - Tcl_SetErrno(ENOENT); + Tcl_SetErrno(err); return -1; } @@ -4437,10 +4443,14 @@ Tcl_FSRemoveDirectory( { const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); - if (fsPtr == NULL || fsPtr->removeDirectoryProc == NULL) { + if (fsPtr == NULL) { Tcl_SetErrno(ENOENT); return -1; } + if (fsPtr->removeDirectoryProc == NULL) { + Tcl_SetErrno(ENOTSUP); + return -1; + } if (recursive) { Tcl_Obj *cwdPtr = Tcl_FSGetCwd(NULL); |
