From eceb6f6c626df0a4e80455036f551980a1321d82 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Tue, 21 Feb 2012 12:16:51 +1000 Subject: 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 --- jim-file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'jim-file.c') 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; -- cgit v1.1