Date: Fri, 15 Apr 2005 01:38:08 GMT From: Wayne Salamon <wsalamon@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 75224 for review Message-ID: <200504150138.j3F1c8VC017257@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=75224 Change 75224 by wsalamon@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; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504150138.j3F1c8VC017257>