evil bug, tested unsigned on < 0 :-/

This commit is contained in:
Axel Kittenberger 2010-11-23 23:19:01 +00:00
parent 90ae92b129
commit 4aff988954
1 changed files with 7 additions and 4 deletions

View File

@ -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 {