PERFORCE change 75224 for review
Wayne Salamon
wsalamon at FreeBSD.org
Fri Apr 15 01:38:08 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=75224
Change 75224 by wsalamon at rickenbacker on 2005/04/15 01:37:42
Fix a bug where, if the execv() fails, the child process hangs around.
In the audit_warn case, the execv() will fail if the audit_warn script
doesn't have the execute bit turned on, for example.
Affected files ...
.. //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/audit_warn.c#3 edit
Differences ...
==== //depot/projects/trustedbsd/audit3/contrib/audit_supt/auditd/audit_warn.c#3 (text+ko) ====
@@ -34,6 +34,7 @@
char *loc_args[9];
int i;
pid_t pid;
+
loc_args[0] = AUDITWARN_SCRIPT;
for (i = 0; args[i] != NULL && i < 8; i++) {
loc_args[i+1] = args[i];
@@ -41,13 +42,13 @@
loc_args[i+1] = NULL;
pid = fork();
- if (pid == 0) {
- return execv(AUDITWARN_SCRIPT, loc_args);
- /* not reached */
- exit(1);
+ if (pid == 0) { // child
+ execv(AUDITWARN_SCRIPT, loc_args);
+ syslog(LOG_ERR, "Could not exec %s\n", AUDITWARN_SCRIPT);
+ exit (1); // if we reach here, the exec failed
} else if (pid == -1) {
return -1;
- } else {
+ } else { // parent
return 0;
}
}
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list