summaryrefslogtreecommitdiff
path: root/pbx/pbx_spool.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-09-07 21:21:00 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-09-07 21:21:00 +0000
commit29249cfb25f4636f1dc4067ae7dac6591baffc9d (patch)
tree6c946b9cee0d095515e3b05e340e6be3d9fe3921 /pbx/pbx_spool.c
parent2302618bb78a987a2cffa7cef663c25f7730fbb2 (diff)
Merged revisions 285386 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r285386 | tilghman | 2010-09-07 16:20:16 -0500 (Tue, 07 Sep 2010) | 13 lines Don't notify on attribute changes, and change how the queuing mechanism works. Fixes call spools in 1.8. (closes issue #17337) Reported by: loloski Patches: 20100827__issue17337.diff.txt uploaded by tilghman (license 14) (closes issue #17924) Reported by: mkeuter Tested by: mkeuter ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@285390 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/pbx_spool.c')
-rw-r--r--pbx/pbx_spool.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 6c7b449a1..7a76aa84b 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -372,6 +372,7 @@ static void launch_service(struct outgoing *o)
}
}
+/* Called from scan_thread or queue_file */
static int scan_service(const char *fn, time_t now)
{
struct outgoing *o = NULL;
@@ -551,7 +552,7 @@ static void *scan_thread(void *unused)
}
#ifdef HAVE_INOTIFY
- inotify_add_watch(inotify_fd, qdir, IN_CREATE | IN_ATTRIB | IN_MOVED_TO);
+ inotify_add_watch(inotify_fd, qdir, IN_CREATE | IN_MOVED_TO);
#endif
/* First, run through the directory and clear existing entries */
@@ -590,8 +591,16 @@ static void *scan_thread(void *unused)
/* When a file arrives, add it to the queue, in mtime order. */
if ((res = poll(&pfd, 1, waittime)) > 0 && (stage = 1) &&
(res = read(inotify_fd, &buf, sizeof(buf))) >= sizeof(buf.iev)) {
- /* File added to directory, add it to my list */
- queue_file(buf.iev.name, 0);
+ /* File(s) added to directory, add them to my list */
+ do {
+ queue_file(buf.iev.name, 0);
+ res -= sizeof(buf.iev) + buf.iev.len;
+ if (res >= sizeof(buf.iev)) {
+ memmove(&buf.iev, &buf.iev.name[buf.iev.len], res);
+ continue;
+ }
+ break;
+ } while (1);
} else if (res < 0 && errno != EINTR && errno != EAGAIN) {
ast_debug(1, "Got an error back from %s(2): %s\n", stage ? "read" : "poll", strerror(errno));
}