* Break out earlier if we see a CLOSE_WRITE, but the file hasn't changed.

This commit is contained in:
Justin Maggard 2010-09-28 07:59:11 +00:00
parent a600d8a231
commit 263b93fb92

View File

@ -705,11 +705,15 @@ start_inotify()
else if ( event->mask & IN_CLOSE_WRITE || event->mask & IN_MOVED_TO ) else if ( event->mask & IN_CLOSE_WRITE || event->mask & IN_MOVED_TO )
{ {
if( stat(path_buf, &st) == 0 && st.st_size > 0 ) if( stat(path_buf, &st) == 0 && st.st_size > 0 )
{
if( (event->mask & IN_MOVED_TO) ||
(sql_get_int_field(db, "SELECT TIMESTAMP from DETAILS where PATH = '%q'", path_buf) != st.st_mtime) )
{ {
DPRINTF(E_DEBUG, L_INOTIFY, "The file %s was %s.\n", path_buf, (event->mask & IN_MOVED_TO ? "moved here" : "changed")); DPRINTF(E_DEBUG, L_INOTIFY, "The file %s was %s.\n", path_buf, (event->mask & IN_MOVED_TO ? "moved here" : "changed"));
inotify_insert_file(esc_name, path_buf); inotify_insert_file(esc_name, path_buf);
} }
} }
}
else if ( event->mask & IN_DELETE || event->mask & IN_MOVED_FROM ) else if ( event->mask & IN_DELETE || event->mask & IN_MOVED_FROM )
{ {
if ( event->mask & IN_ISDIR ) if ( event->mask & IN_ISDIR )