Code cleanup in execute
This commit is contained in:
parent
a479fa7b77
commit
3dd457a305
@ -96,7 +96,7 @@ v0.51.2 06-Mar-2004
|
|||||||
html.nodes and filemgr.status.
|
html.nodes and filemgr.status.
|
||||||
|
|
||||||
lang:
|
lang:
|
||||||
removed obsolede prompt 240.
|
removed obsolete prompt 240.
|
||||||
Updated germandu.txt (by Malte Tychsen).
|
Updated germandu.txt (by Malte Tychsen).
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ int _execute(char **, char *, char *, char *);
|
|||||||
int _execute(char **args, char *in, char *out, char *err)
|
int _execute(char **args, char *in, char *out, char *err)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int i, pid, terrno = 0, status = 0, rc = 0;
|
int i, pid, status = 0, rc = 0;
|
||||||
|
|
||||||
memset(&buf, 0, sizeof(buf));
|
memset(&buf, 0, sizeof(buf));
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
@ -86,13 +86,10 @@ int _execute(char **args, char *in, char *out, char *err)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
if (CFG.priority) {
|
if (CFG.priority) {
|
||||||
rc = getpriority(PRIO_PROCESS, 0);
|
rc = getpriority(PRIO_PROCESS, 0);
|
||||||
Syslog('e', "getpriority in child %d", rc);
|
|
||||||
if (errno == 0) {
|
if (errno == 0) {
|
||||||
rc = setpriority(PRIO_PROCESS, 0, CFG.priority);
|
rc = setpriority(PRIO_PROCESS, 0, CFG.priority);
|
||||||
if (rc)
|
if (rc)
|
||||||
WriteError("$execv can't set priority to %d", CFG.priority);
|
WriteError("$execv can't set priority to %d", CFG.priority);
|
||||||
rc = getpriority(PRIO_PROCESS, 0);
|
|
||||||
Syslog('e', "getpriority in set to %d", rc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rc = execv(args[0],args);
|
rc = execv(args[0],args);
|
||||||
@ -107,14 +104,6 @@ int _execute(char **args, char *in, char *out, char *err)
|
|||||||
e_pid = 0;
|
e_pid = 0;
|
||||||
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
||||||
|
|
||||||
terrno = errno;
|
|
||||||
if (CFG.priority) {
|
|
||||||
rc = getpriority(PRIO_PROCESS, 0);
|
|
||||||
Syslog('e', "getpriority in parent %d", rc);
|
|
||||||
setpriority(PRIO_PROCESS, 0, 0);
|
|
||||||
}
|
|
||||||
errno = terrno;
|
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case -1:
|
case -1:
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user