ath9k: fix adhoc beacon issues (#9163)
[openwrt.git] / package / fuse / patches / 300-workaround-uclibc-pthread-breakage.patch
1 --- a/lib/helper.c
2 +++ b/lib/helper.c
3 @@ -180,13 +180,41 @@ err:
4 int fuse_daemonize(int foreground)
5 {
6 int res;
7 + int fd;
8
9 if (!foreground) {
10 - res = daemon(0, 0);
11 + /* uClibc daemon() has problems with pthread and friends */
12 + /* workaround from http://www.mail-archive.com/uclibc@uclibc.org/msg01073.html */
13 + /* res = daemon(0, 0); */
14 + switch (res = fork()) {
15 + case -1:
16 + return(-1);
17 + case 0:
18 + break;
19 + default:
20 + _exit(0);
21 + }
22 +
23 if (res == -1) {
24 - perror("fuse: failed to daemonize program\n");
25 + perror("fuse: failed to fork()\n");
26 return -1;
27 }
28 +
29 + res=setsid();
30 +
31 + if (res == -1) {
32 + perror("fuse: failed to setsid()\n");
33 + }
34 +
35 + chdir("/");
36 +
37 + if (fd = open("/dev/null", O_RDWR, 0) != -1) {
38 + dup2(fd, STDIN_FILENO);
39 + dup2(fd, STDOUT_FILENO);
40 + dup2(fd, STDERR_FILENO);
41 + if (fd > 2)
42 + close(fd);
43 + }
44 }
45 return 0;
46 }
This page took 0.047768 seconds and 5 git commands to generate.