aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2012-02-21 12:16:51 +1000
committerSteve Bennett <steveb@workware.net.au>2012-02-21 12:18:48 +1000
commiteceb6f6c626df0a4e80455036f551980a1321d82 (patch)
treebce99f283942227ebe74d1eaf037ecc2c31f5b5e /jim-file.c
parent2e8b9ddb92ed1cea3054ed8180d363c9dcc72dd9 (diff)
downloadjimtcl-eceb6f6c626df0a4e80455036f551980a1321d82.zip
jimtcl-eceb6f6c626df0a4e80455036f551980a1321d82.tar.gz
jimtcl-eceb6f6c626df0a4e80455036f551980a1321d82.tar.bz2
file normalize only works with an existing path
Because file normalize uses realpath(), the path must exist. This is not 100% compatible with Tcl which can also normalize nonexistent paths. Don't ignore the error from realpath() Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-file.c')
-rw-r--r--jim-file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/jim-file.c b/jim-file.c
index 053873c..8214437 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -267,12 +267,13 @@ static int file_cmd_normalize(Jim_Interp *interp, int argc, Jim_Obj *const *argv
if (realpath(path, newname)) {
Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, newname, -1));
+ return JIM_OK;
}
else {
Jim_Free(newname);
- Jim_SetResult(interp, argv[0]);
+ Jim_SetResultFormatted(interp, "can't normalize \"%#s\": %s", argv[0], strerror(errno));
+ return JIM_ERR;
}
- return JIM_OK;
#else
Jim_SetResultString(interp, "Not implemented", -1);
return JIM_ERR;