diff options
author | Steve Bennett <steveb@workware.net.au> | 2012-02-21 12:16:51 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2012-02-21 12:18:48 +1000 |
commit | eceb6f6c626df0a4e80455036f551980a1321d82 (patch) | |
tree | bce99f283942227ebe74d1eaf037ecc2c31f5b5e /jim-file.c | |
parent | 2e8b9ddb92ed1cea3054ed8180d363c9dcc72dd9 (diff) | |
download | jimtcl-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |