Fixed execute logging

This commit is contained in:
Michiel Broek 2005-08-30 18:38:39 +00:00
parent 68ab3f4eef
commit 20864b64b4
3 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,6 @@
int e_pid = 0; /* Execute child pid */ int e_pid = 0; /* Execute child pid */
int _execute(char **, char *, char *, char *); 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)
{ {
@ -45,7 +44,7 @@ int _execute(char **args, char *in, char *out, char *err)
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (args[i]) if (args[i])
snprintf(buf, PATH_MAX -1, "%s %s", buf, args[i]); snprintf(buf + strlen(buf), PATH_MAX - strlen(buf), " %s", args[i]);
else else
break; break;
} }

View File

@ -164,9 +164,10 @@ int execute(char **args, char *in, char *out, char *err)
char buf[PATH_MAX]; char buf[PATH_MAX];
int i, pid, status = 0, rc = 0; int i, pid, status = 0, rc = 0;
memset(&buf, 0, sizeof(buf));
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (args[i]) if (args[i])
snprintf(buf, PATH_MAX, "%s %s", buf, args[i]); snprintf(buf + strlen(buf), PATH_MAX - strlen(buf), " %s", args[i]);
else else
break; break;
} }

View File

@ -91,7 +91,7 @@ int execute(char **args, char *in, char *out, char *err)
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (args[i]) if (args[i])
snprintf(buf, PATH_MAX, "%s %s", buf, args[i]); snprintf(buf + strlen(buf), PATH_MAX - strlen(buf), " %s", args[i]);
else else
break; break;
} }