* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
if (pos == NULL)
return -1;
pos = &pos[1];
+ info(udev, "resolved link to: '%s'\n", pos);
return util_strlcpy(subsystem, pos, size);
}
int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
{
+ struct stat statbuf;
char link_target[UTIL_PATH_SIZE];
int len;
int i;
int back;
+ if (lstat(syspath, &statbuf) < 0)
+ return -1;
+ if (!S_ISLNK(statbuf.st_mode))
+ return -1;
len = readlink(syspath, link_target, sizeof(link_target));
if (len <= 0)
return -1;