1 From: Jaska Uimonen <jaska.uimonen@intel.com>
2 Date: Thu, 8 Aug 2013 11:27:44 +0300
3 Subject: cope with possible infinite waiting in startup - samsung
5 Change-Id: Ie7c74131e267f44324f031a953c15f81b0c31a07
6 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
8 src/pulsecore/core-util.c | 19 ++++++++++++++++++-
9 1 file changed, 18 insertions(+), 1 deletion(-)
11 diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
12 index 0d9e354..1256a1e 100644
13 --- a/src/pulsecore/core-util.c
14 +++ b/src/pulsecore/core-util.c
15 @@ -1698,6 +1698,7 @@ static char* make_random_dir(mode_t m) {
20 fn = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse-XXXXXXXXXXXX", pa_get_temp_dir());
23 @@ -1763,6 +1764,7 @@ static int make_random_dir_and_link(mode_t m, const char *k) {
24 char *pa_get_runtime_dir(void) {
25 char *d, *k = NULL, *p = NULL, *t = NULL, *mid;
27 + int retry_count = 100;
29 /* The runtime directory shall contain dynamic data that needs NOT
30 * to be kept across reboots and is usually private to the user,
31 @@ -1823,6 +1825,21 @@ char *pa_get_runtime_dir(void) {
33 /* OK, first let's check if the "runtime" symlink already exists */
35 + /* FIXME: This is recovery routine for infinite waiting issue such as below situation.
36 + * eg. 50f64052a5dbbe087c11dfac4effb63c-runtime -> /tmp/pulse-LDK8gTL6Dh9N
37 + 50f64052a5dbbe087c11dfac4effb63c-runtime.tmp -> /tmp/pulse-cDM1bQhObZ7O */
38 + if (retry_count-- == 0) {
39 + pa_log_error ("retry is over....do cleanup");
41 + /* Remove original file */
44 + /* Remove original.tmp file */
45 + t = pa_sprintf_malloc("%s.tmp", k);
53 @@ -3297,7 +3314,7 @@ const char *pa_get_temp_dir(void) {
54 pa_is_path_absolute(t))
58 + return "/tmp/pulseaudio";
61 int pa_open_cloexec(const char *fn, int flags, mode_t mode) {