Date: Mon, 14 Apr 2014 22:32:59 GMT From: Christian Brueffer <brueffer@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 1192820 for review Message-ID: <201404142232.s3EMWxPb084358@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1192820?ac=10 Change 1192820 by brueffer@brueffer_freefall on 2014/04/14 22:32:54 Check readlink() return value; auditd_expire_trails() may return ADE_READLINK now. While here, fix a comment typo. Affected files ... .. //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#18 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#19 $ */ #include <sys/param.h> @@ -402,12 +402,13 @@ * ADE_NOERR on success or there is nothing to do. * ADE_PARSE if error parsing audit_control(5). * ADE_NOMEM if could not allocate memory. - * ADE_EXPIRE if there was an unespected error. + * ADE_READLINK if could not read link file. + * ADE_EXPIRE if there was an unexpected error. */ int auditd_expire_trails(int (*warn_expired)(char *)) { - int andflg, ret = ADE_NOERR; + int andflg, len, ret = ADE_NOERR; size_t expire_size, total_size = 0L; time_t expire_age, oldest_time, current_time = time(NULL); struct dir_ent *traildir; @@ -431,7 +432,9 @@ * Read the 'current' trail file name. Trim off directory path. */ activefn[0] = '\0'; - readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + len = readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + if (len < 0) + return (ADE_READLINK); if ((afnp = strrchr(activefn, '/')) != NULL) afnp++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404142232.s3EMWxPb084358>