So, do you mean it is good to do realpath() and only then stat() etc.? CheckTtyname (tty) { <realpath>; <check real path>; } ?