diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c index 438b0e502fe0..6ebdb30ab82b 100644 --- a/lib/libcam/camlib.c +++ b/lib/libcam/camlib.c @@ -128,10 +128,13 @@ cam_get_device(const char *path, char *dev_name, int devnamelen, int *unit) } /* - * We can be rather destructive to the path string. Make a copy of - * it so we don't hose the user's string. + * Resolve the given path to a real device path in case we are given + * an alias or other symbolic link. If the path cannot be resolved + * then try to parse it as is. */ - newpath = (char *)strdup(path); + newpath = realpath(path, NULL); + if (newpath == NULL) + newpath = strdup(path); if (newpath == NULL) return (-1);