Page MenuHomeFreeBSD

Correct the success return value for au_read_rec() in au_io.3
ClosedPublic

Authored by aniketp on May 30 2018, 4:35 PM.
Tags
None
Referenced Files
F132028314: D15618.id43147.diff
Mon, Oct 13, 2:01 AM
Unknown Object (File)
Sat, Oct 11, 3:44 PM
Unknown Object (File)
Sat, Oct 11, 12:53 AM
Unknown Object (File)
Thu, Oct 2, 12:46 PM
Unknown Object (File)
Tue, Sep 30, 6:53 AM
Unknown Object (File)
Tue, Sep 30, 3:18 AM
Unknown Object (File)
Mon, Sep 29, 11:42 PM
Unknown Object (File)
Mon, Sep 29, 11:03 AM
Subscribers

Details

Summary

The manpage of au_io.3 shows the incorrect success return value of au_read_rec() as 0,
since it returns the number of bytes read from a file stream.
Correct implementation done here: bsmtrace/bsm.c

 C
while ((reclen = au_read_rec(fp, &bsm_rec)) != -1) {
        ....
        bd.br_raw_len = reclen;
        ....
}

Here, on success, the function returns no. of bytes which is stored in reclen.

Pull Request: https://github.com/openbsm/openbsm/pull/25

Test Plan

Use au_read_rec() to correctly read the BSM tokens. On printing the return value,
you'd either see -1 if something went wrong or the length of the tokens read if the implementation is correct.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aniketp edited the test plan for this revision. (Show Details)
asomers requested changes to this revision.May 30 2018, 4:48 PM
asomers added inline comments.
contrib/openbsm/libbsm/au_io.3
27 ↗(On Diff #43143)

You need to bump the man page revision date.

132 ↗(On Diff #43143)

You don't need "The function". It's ok to use function names like proper nouns.

134 ↗(On Diff #43143)

s/returns 0/returns 0 on success/

136 ↗(On Diff #43143)

The comma is unneeded. Though the sentence might actually sound better if you move "on success" to the beginning.

This revision now requires changes to proceed.May 30 2018, 4:48 PM
aniketp marked 4 inline comments as done.

Update the revision following the inline suggestions

This revision is now accepted and ready to land.May 30 2018, 4:57 PM
This revision was automatically updated to reflect the committed changes.