mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
my_system: return errno, silence trivial error message
Origin commit data
------------------
Branch: ni/coolstream
Commit: d77e54fcd6
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-03-09 (Sat, 09 Mar 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -102,7 +102,8 @@ int my_system(int argc, const char *arg, ...)
|
||||
{
|
||||
case -1: /* can't vfork */
|
||||
perror("vfork");
|
||||
return -1;
|
||||
ret = -errno;
|
||||
goto out;
|
||||
case 0: /* child process */
|
||||
for(i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
@@ -110,17 +111,21 @@ int my_system(int argc, const char *arg, ...)
|
||||
perror("my_system setsid");
|
||||
if (execvp(argv[0], (char * const *)argv))
|
||||
{
|
||||
std::string txt = "ERROR: my_system \"" + (std::string) argv[0] + "\"";
|
||||
perror(txt.c_str());
|
||||
ret = -1;
|
||||
if (errno != ENOENT) { /* don't complain if argv[0] only does not exist */
|
||||
std::string txt = "ERROR: my_system \"" + (std::string) argv[0] + "\"";
|
||||
perror(txt.c_str());
|
||||
}
|
||||
ret = -errno;
|
||||
}
|
||||
_exit (0); // terminate c h i l d proces s only
|
||||
default: /* parent returns to calling process */
|
||||
break;
|
||||
}
|
||||
/* it is probably pure luck that ret gets propagated back from child to parent */
|
||||
waitpid(pid, &childExit, 0);
|
||||
if(childExit != 0)
|
||||
ret = childExit;
|
||||
out:
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user