From 305da4168b71478924cb7df301511e39fc5102db Mon Sep 17 00:00:00 2001 From: Marcin Lewandowski Date: Thu, 30 Jun 2016 12:38:14 +0200 Subject: [PATCH] pa_pipe_cloexec: Log error if we hit file descriptors limit diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index b6eb85a..ea7acb9 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -3490,6 +3490,16 @@ int pa_pipe_cloexec(int pipefd[2]) { if ((r = pipe2(pipefd, O_CLOEXEC)) >= 0) goto finish; + if (errno == EMFILE) { + pa_log_error("The per-process limit on the number of open file descriptors has been reached."); + return r; + } + + if (errno == ENFILE) { + pa_log_error("The system-wide limit on the total number of open files has been reached."); + return r; + } + if (errno != EINVAL && errno != ENOSYS) return r; @@ -3498,6 +3508,16 @@ int pa_pipe_cloexec(int pipefd[2]) { if ((r = pipe(pipefd)) >= 0) goto finish; + if (errno == EMFILE) { + pa_log_error("The per-process limit on the number of open file descriptors has been reached."); + return r; + } + + if (errno == ENFILE) { + pa_log_error("The system-wide limit on the total number of open files has been reached."); + return r; + } + /* return error */ return r; -- 2.7.4