* Fix Samba copy errors with inotify enabled.
This commit is contained in:
parent
e18cf08880
commit
590f0761f4
19
inotify.c
19
inotify.c
@ -399,10 +399,11 @@ inotify_insert_directory(int fd, char *name, const char * path)
|
|||||||
char **result;
|
char **result;
|
||||||
char *id=NULL, *path_buf, *parent_buf, *esc_name;
|
char *id=NULL, *path_buf, *parent_buf, *esc_name;
|
||||||
int wd;
|
int wd;
|
||||||
int rows, i = 0;
|
int rows;
|
||||||
enum file_types type = TYPE_UNKNOWN;
|
enum file_types type = TYPE_UNKNOWN;
|
||||||
enum media_types dir_type = ALL_MEDIA;
|
enum media_types dir_type = ALL_MEDIA;
|
||||||
struct media_dir_s * media_path;
|
struct media_dir_s * media_path;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
parent_buf = dirname(strdup(path));
|
parent_buf = dirname(strdup(path));
|
||||||
sql = sqlite3_mprintf("SELECT OBJECT_ID from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"
|
sql = sqlite3_mprintf("SELECT OBJECT_ID from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"
|
||||||
@ -438,8 +439,11 @@ inotify_insert_directory(int fd, char *name, const char * path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ds = opendir(path);
|
ds = opendir(path);
|
||||||
if( ds != NULL )
|
if( !ds )
|
||||||
{
|
{
|
||||||
|
DPRINTF(E_ERROR, L_INOTIFY, "opendir failed! [%s]\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
while( (e = readdir(ds)) )
|
while( (e = readdir(ds)) )
|
||||||
{
|
{
|
||||||
if( strcmp(e->d_name, ".") == 0 ||
|
if( strcmp(e->d_name, ".") == 0 ||
|
||||||
@ -464,21 +468,18 @@ inotify_insert_directory(int fd, char *name, const char * path)
|
|||||||
inotify_insert_directory(fd, esc_name, path_buf);
|
inotify_insert_directory(fd, esc_name, path_buf);
|
||||||
}
|
}
|
||||||
else if( type == TYPE_FILE )
|
else if( type == TYPE_FILE )
|
||||||
|
{
|
||||||
|
if( (stat(path_buf, &st) == 0) && (st.st_blocks<<9 >= st.st_size) )
|
||||||
{
|
{
|
||||||
inotify_insert_file(esc_name, path_buf);
|
inotify_insert_file(esc_name, path_buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free(esc_name);
|
free(esc_name);
|
||||||
free(path_buf);
|
free(path_buf);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DPRINTF(E_ERROR, L_INOTIFY, "opendir failed! [%s]\n", strerror(errno));
|
|
||||||
}
|
|
||||||
closedir(ds);
|
closedir(ds);
|
||||||
i++;
|
|
||||||
|
|
||||||
return(i);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user