clean pulseaudio recipes
[scm/bb/meta-tizen.git] / recipes-multimedia / pulseaudio / pulseaudio_5.0 / 0042-cope-with-possible-infinite-waiting-in-startup-samsu.patch
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
4
5 Change-Id: Ie7c74131e267f44324f031a953c15f81b0c31a07
6 Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
7 ---
8  src/pulsecore/core-util.c | 19 ++++++++++++++++++-
9  1 file changed, 18 insertions(+), 1 deletion(-)
10
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) {
16      char *fn;
17      size_t pathlen;
18  
19 +    srand (time(NULL));
20      fn = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse-XXXXXXXXXXXX", pa_get_temp_dir());
21      pathlen = strlen(fn);
22  
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;
26      mode_t m;
27 +    int retry_count = 100;
28  
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) {
32      for (;;) {
33          /* OK, first let's check if the "runtime" symlink already exists */
34  
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");
40 +
41 +            /* Remove original file */
42 +            unlink (k);
43 +
44 +            /* Remove original.tmp file */
45 +            t = pa_sprintf_malloc("%s.tmp", k);
46 +            unlink (t);
47 +            pa_xfree(t);
48 +            t = NULL;
49 +        }
50          p = pa_readlink(k);
51          if (!p) {
52  
53 @@ -3297,7 +3314,7 @@ const char *pa_get_temp_dir(void) {
54          pa_is_path_absolute(t))
55          return t;
56  
57 -    return "/tmp";
58 +    return "/tmp/pulseaudio";
59  }
60  
61  int pa_open_cloexec(const char *fn, int flags, mode_t mode) {