summaryrefslogtreecommitdiff
path: root/jackd
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-11-12 22:07:39 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2012-11-12 22:07:39 -0500
commit547398c217143e72ee3e2081c0dc75a5d7c608c3 (patch)
treed739a4b89af536c030c4e8b6167f25bea68b633a /jackd
parent63533686e5841b7ec1b28e837c954f03909d80b5 (diff)
downloadjack1-547398c217143e72ee3e2081c0dc75a5d7c608c3.tar.gz
fix from ticket #294 to cover failed malloc caused by limits.conf being changed while jackd runs
Diffstat (limited to 'jackd')
-rw-r--r--jackd/engine.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/jackd/engine.c b/jackd/engine.c
index 5faf2a1..0ebfb1d 100644
--- a/jackd/engine.c
+++ b/jackd/engine.c
@@ -1598,7 +1598,26 @@ jack_server_thread (void *arg)
if (engine->pfd) {
free (engine->pfd);
}
- engine->pfd = (struct pollfd *) malloc (sizeof(struct pollfd) * (fixed_fd_cnt + clients));
+
+ engine->pfd = (struct pollfd *) malloc(sizeof(struct pollfd) *
+ (fixed_fd_cnt + clients));
+
+ if (engine->pfd == NULL) {
+ /*
+ * this can happen if limits.conf was changed
+ * but the user hasn't logged out and back in yet
+ */
+ if (errno == EAGAIN)
+ jack_error("malloc failed (%s) - make"
+ "sure you log out and back"
+ "in after changing limits"
+ ".conf!", strerror(errno));
+ else
+ jack_error("malloc failed (%s)",
+ strerror(errno));
+
+ break;
+ }
}
engine->pfd[0].fd = engine->fds[0];