inotify: Recognize new hard links.

Based on SF patch #139 (Thanks Alenky Klaus).
This commit is contained in:
Justin Maggard 2015-07-30 14:54:39 -07:00
parent 8e201fec7b
commit 5a309fc48f

View File

@ -716,9 +716,10 @@ start_inotify()
else if ( (event->mask & (IN_CLOSE_WRITE|IN_MOVED_TO|IN_CREATE)) &&
(lstat(path_buf, &st) == 0) )
{
if( S_ISLNK(st.st_mode) )
if( (event->mask & (IN_MOVED_TO|IN_CREATE)) && (S_ISLNK(st.st_mode) || st.st_nlink > 1) )
{
DPRINTF(E_DEBUG, L_INOTIFY, "The symbolic link %s was %s.\n",
DPRINTF(E_DEBUG, L_INOTIFY, "The %s link %s was %s.\n",
(S_ISLNK(st.st_mode) ? "symbolic" : "hard"),
path_buf, (event->mask & IN_MOVED_TO ? "moved here" : "created"));
if( stat(path_buf, &st) == 0 && S_ISDIR(st.st_mode) )
inotify_insert_directory(pollfds[0].fd, esc_name, path_buf);