From 633da6fd8df682f221f18b7a525667f0fe2b7ce1 Mon Sep 17 00:00:00 2001 From: Matthias Janssen Date: Mon, 29 Nov 2010 21:50:46 +0100 Subject: Insert new symlinks recognized by ionotify This patch enables minidlna to insert new symbolic links when recognized by ionotify. This feature is useful if you use mythlink or some other script that creates symlinks in minidlna's folder. --- inotify.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inotify.c b/inotify.c index 7353940..c487d5d 100644 --- a/inotify.c +++ b/inotify.c @@ -725,6 +725,15 @@ start_inotify() } } } + /* Insert new or moved symlinks (e.g. the symlinks created by mythlink) */ + else if ( event->mask & IN_CREATE || event->mask & IN_MOVED_TO ) + { + if( stat(path_buf, &st) == 0 && ((st.st_mode & S_IFMT) & S_IFLNK) ) + { + DPRINTF(E_DEBUG, L_INOTIFY, "The symbolic link %s was %s.\n", path_buf, (event->mask & IN_MOVED_TO ? "moved here" : "created")); + inotify_insert_file(esc_name, path_buf); + } + } else if ( event->mask & (IN_DELETE|IN_MOVED_FROM) ) { DPRINTF(E_DEBUG, L_INOTIFY, "The %s %s was %s.\n", -- cgit v1.2.3