mirror of
https://git.busybox.net/buildroot.git
synced 2024-12-14 15:53:29 +08:00
86f2543c8c
[Peter: Small tweaks, add patch descriptions] Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
35 lines
802 B
Diff
35 lines
802 B
Diff
written by Mike Frysinger
|
|
|
|
https://sourceforge.net/tracker/?func=detail&aid=3132053&group_id=5616&atid=305616
|
|
|
|
Rather than using the fork function (which doesnt work on nommu
|
|
systems), simply use the daemon() function instead (which does
|
|
work). this should work the same before and after for all systems.
|
|
|
|
--- a/irattach/util.c
|
|
+++ b/irattach/util.c
|
|
@@ -156,21 +156,10 @@
|
|
|
|
void fork_now(int ttyfd)
|
|
{
|
|
- int ret;
|
|
int i;
|
|
|
|
- if ((ret = fork()) > 0)
|
|
- exit(0);
|
|
-
|
|
- if (ret == -1)
|
|
- syslog(LOG_INFO, "forking: %m");
|
|
- if (setsid() < 0)
|
|
- syslog(LOG_INFO, "detaching from tty: %m");
|
|
-
|
|
- if ((ret = fork()) > 0) {
|
|
- /* cleanup_files = 0; */
|
|
- exit(0);
|
|
- }
|
|
+ if (daemon(1, 1))
|
|
+ syslog(LOG_INFO, "daemon: %m");
|
|
|
|
/* Close all open inherited files! Except for ttyfd! */
|
|
for (i = 0; i < 64; i++)
|