This is simply icquired by using `realpath(3)` of value passed with -p parameter instead of its original value.
Signed-off-by: Ivan Oleynikov <i...@metrotek.spb.ru> --- ptp4l.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ptp4l.c b/ptp4l.c index a87e7e6..090b75a 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -22,6 +22,8 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <limits.h> +#include <errno.h> #include "clock.h" #include "config.h" @@ -72,7 +74,8 @@ static void usage(char *progname) int main(int argc, char *argv[]) { - char *config = NULL, *req_phc = NULL, *progname; + char req_phc[PATH_MAX]; + char *config = NULL, *progname; int c, err = -1, print_level; struct clock *clock = NULL; struct config *cfg; @@ -137,7 +140,11 @@ int main(int argc, char *argv[]) goto out; break; case 'p': - req_phc = optarg; + if (!realpath(optarg, req_phc)) { + pr_err("realpath(%s): %s", optarg, strerror(errno)); + goto out; + } + pr_debug("using %s as realpath of %s", req_phc, optarg); break; case 's': if (config_set_int(cfg, "slaveOnly", 1)) { -- 2.1.4 -- Ivan Oleynikov STC Metrotek St.Petersburg ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel