relocate packages on recipes-base/recipes-enigma2/recipes-wlan.
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-connectivity / autofs / autofs-4.1.4 / 078_locking_fix_1.patch
1 #!/bin/sh /usr/share/dpatch/dpatch-run
2 ## 078_locking_fix_1.dpatch
3 ##
4 ## DP: No description.
5
6 @DPATCH@
7
8 diff -Naur .B/daemon/spawn.c .A/daemon/spawn.c
9 --- .B/daemon/spawn.c   2007-01-07 21:36:36.000000000 +0000
10 +++ .A/daemon/spawn.c   2007-01-07 21:36:36.000000000 +0000
11 @@ -214,14 +214,15 @@
12         sigfillset(&allsignals);
13         sigprocmask(SIG_BLOCK, &allsignals, &oldsig);
14  
15 -       if (pipe(pipefd))
16 +       if (pipe(pipefd)) {
17 +               if (use_lock)
18 +                       release_lock();
19 +               sigprocmask(SIG_SETMASK, &oldsig, NULL);
20                 return -1;
21 +       }
22  
23         f = fork();
24 -       if (f < 0) {
25 -               sigprocmask(SIG_SETMASK, &oldsig, NULL);
26 -               return -1;
27 -       } else if (f == 0) {
28 +       if (f == 0) {
29                 reset_signals();
30                 close(pipefd[0]);
31                 dup2(pipefd[1], STDOUT_FILENO);
32 @@ -243,6 +244,8 @@
33  
34                 if (f < 0) {
35                         close(pipefd[0]);
36 +                       if (use_lock)
37 +                               release_lock();
38                         sigprocmask(SIG_SETMASK, &oldsig, NULL);
39                         return -1;
40                 }
41 @@ -287,11 +290,11 @@
42                 if (waitpid(f, &status, 0) != f)
43                         status = -1;    /* waitpid() failed */
44  
45 -               sigprocmask(SIG_SETMASK, &oldsig, NULL);
46 -
47                 if (use_lock)
48                         release_lock();
49  
50 +               sigprocmask(SIG_SETMASK, &oldsig, NULL);
51 +
52                 return status;
53         }
54  }
55 diff -Naur .B/lib/lock.c .A/lib/lock.c
56 --- .B/lib/lock.c       2005-01-17 15:09:28.000000000 +0000
57 +++ .A/lib/lock.c       2007-01-07 21:36:36.000000000 +0000
58 @@ -208,9 +208,6 @@
59   */
60  static int wait_for_lockf(const char *lockf)
61  {
62 -       struct timespec t = { 0, WAIT_INTERVAL };
63 -       struct timespec r;
64 -       int ts_size = sizeof(struct timespec);
65         int tries = WAIT_TRIES;
66         int status = 0;
67         struct stat st;
68 @@ -218,10 +215,13 @@
69         while (tries-- && !status) {
70                 status = stat(lockf, &st);
71                 if (!status) {
72 +                       struct timespec t = { 0, WAIT_INTERVAL };
73 +                       struct timespec r;
74 +
75                         while (nanosleep(&t, &r) == -1 && errno == EINTR) {
76                                 if (got_term)
77                                         return 0;
78 -                               memcpy(&t, &r, ts_size);
79 +                               memcpy(&t, &r, sizeof(struct timespec));
80                         }
81                 }
82         }