X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fpnd_notify.c;h=6f0e634ad5fd8916cfca774a96a241fd81904e87;hb=9bcf4a8f226054410f49bbda871acc748fff48e3;hp=9c377c7638c12d727d09fa5350a861f906252fd2;hpb=28238a8abe41348c61991a6c1e16175373393162;p=pandora-libraries.git diff --git a/lib/pnd_notify.c b/lib/pnd_notify.c index 9c377c7..6f0e634 100644 --- a/lib/pnd_notify.c +++ b/lib/pnd_notify.c @@ -3,6 +3,7 @@ #include // for stdio, NULL #include // for malloc, etc #include // for close +#include // for errno #include // for time() #define _XOPEN_SOURCE 500 @@ -22,9 +23,9 @@ static int notify_handle; //static void pnd_notify_hookup ( int fd ); #if 1 -#define PND_INOTIFY_MASK IN_CREATE | IN_DELETE | IN_UNMOUNT \ +#define PND_INOTIFY_MASK IN_DELETE | IN_UNMOUNT \ | IN_DELETE_SELF | IN_MOVE_SELF \ - | IN_MOVED_FROM | IN_MOVED_TO | IN_MODIFY + | IN_MOVED_FROM | IN_MOVED_TO | IN_CLOSE_WRITE #else #define PND_INOTIFY_MASK IN_ALL_EVENTS #endif @@ -136,6 +137,7 @@ unsigned char pnd_notify_rediscover_p ( pnd_notify_handle h ) { retcode = select ( (p->fd) + 1, &rfds, NULL, NULL, &t ); if ( retcode < 0 ) { + pnd_log ( 3, "ERROR: notify: select failed: %d\n", errno ); return ( 0 ); // hmm.. need a better error code handler } else if ( retcode == 0 ) { return ( 0 ); // timeout @@ -153,6 +155,7 @@ unsigned char pnd_notify_rediscover_p ( pnd_notify_handle h ) { actuallen = read ( (p->fd), binbuf, BINBUFLEN ); if ( actuallen < 0 ) { + pnd_log ( 3, "ERROR: notify: read failed: %d\n", errno ); return ( 0 ); // error } else if ( actuallen == 0 ) { return ( 0 ); // nothing, or overflow, or .. whatever. @@ -251,3 +254,13 @@ unsigned char pnd_notify_wait_until_ready ( unsigned int secs_timeout ) { return ( 0 ); // fail } + +int pnd_notify_fd ( pnd_notify_handle h ) { + pnd_notify_t *p = (pnd_notify_t*) h; + int r = -1; + + if ( p ) + r = p->fd; + + return r; +}