mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
my_system/my_popen: detach the children from neutrino's terminal
Origin commit data
------------------
Branch: ni/coolstream
Commit: b37a778012
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-03-02 (Sat, 02 Mar 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
|
||||
License: GPL
|
||||
|
||||
(C) 2012-2013 the neutrino-hd developers
|
||||
(C) 2012,2013 Stefan Seyfried
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -83,6 +86,8 @@ int my_system(const char * cmd, const char * arg1, const char * arg2, const char
|
||||
case 0: /* child process */
|
||||
for(i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
if (setsid() == -1)
|
||||
perror("my_system setsid");
|
||||
if(execlp(cmd, cmd, arg1, arg2, arg3, arg4, arg5, arg6, (char*)NULL))
|
||||
{
|
||||
std::string txt = "ERROR: my_system \"" + (std::string) cmd + "\"";
|
||||
@@ -132,6 +137,8 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
int maxfd = getdtablesize();
|
||||
for(int i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
if (setsid() == -1)
|
||||
perror("my_popen setsid");
|
||||
execl("/bin/sh", "sh", "-c", cmdstring, (char *)0);
|
||||
exit(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user