mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-12 14:17:47 +00:00
evil bug, tested unsigned on < 0 :-/
This commit is contained in:
parent
90ae92b129
commit
4aff988954
11
inotify.c
11
inotify.c
@ -147,7 +147,7 @@ handle_event(lua_State *L,
|
|||||||
( !(IN_MOVED_TO & event->mask) ||
|
( !(IN_MOVED_TO & event->mask) ||
|
||||||
event->cookie != move_event_buf->cookie) ) {
|
event->cookie != move_event_buf->cookie) ) {
|
||||||
/* there is a MOVE_FROM event in the buffer and this is not the match
|
/* there is a MOVE_FROM event in the buffer and this is not the match
|
||||||
* continue in this function iteration to handler the buffer instead */
|
* continue in this function iteration to handle the buffer instead */
|
||||||
after_buf = event;
|
after_buf = event;
|
||||||
event = move_event_buf;
|
event = move_event_buf;
|
||||||
event_type = DELETE;
|
event_type = DELETE;
|
||||||
@ -225,6 +225,7 @@ handle_event(lua_State *L,
|
|||||||
exit(-1); // ERRNO
|
exit(-1); // ERRNO
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
/* if there is a buffered event executes it */
|
/* if there is a buffered event executes it */
|
||||||
if (after_buf) {
|
if (after_buf) {
|
||||||
logstring("Inotify", "handling buffered event.");
|
logstring("Inotify", "handling buffered event.");
|
||||||
@ -247,10 +248,12 @@ static void
|
|||||||
inotify_ready(lua_State *L, int fd, void *extra)
|
inotify_ready(lua_State *L, int fd, void *extra)
|
||||||
{
|
{
|
||||||
while(true) {
|
while(true) {
|
||||||
size_t len;
|
ptrdiff_t len;
|
||||||
|
int err;
|
||||||
do {
|
do {
|
||||||
len = read (inotify_fd, readbuf, readbuf_size);
|
len = read (inotify_fd, readbuf, readbuf_size);
|
||||||
if (len < 0 && errno == EINVAL) {
|
err = errno;
|
||||||
|
if (len < 0 && err == EINVAL) {
|
||||||
/* kernel > 2.6.21 indicates that way that way that
|
/* kernel > 2.6.21 indicates that way that way that
|
||||||
* the buffer was too small to fit a filename.
|
* the buffer was too small to fit a filename.
|
||||||
* double its size and try again. When using a lower
|
* double its size and try again. When using a lower
|
||||||
@ -267,7 +270,7 @@ inotify_ready(lua_State *L, int fd, void *extra)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
if (errno == EAGAIN) {
|
if (err == EAGAIN) {
|
||||||
/* nothing more inotify */
|
/* nothing more inotify */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user