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
F103455884: D15618.diff
Mon, Nov 25, 6:32 AM
F103440265: D15618.id43145.diff
Mon, Nov 25, 1:40 AM
Unknown Object (File)
Sat, Nov 23, 7:21 PM
Unknown Object (File)
Sat, Nov 23, 12:34 AM
Unknown Object (File)
Fri, Nov 22, 10:45 AM
Unknown Object (File)
Fri, Nov 22, 9:28 AM
Unknown Object (File)
Fri, Nov 22, 7:22 AM
Unknown Object (File)
Thu, Nov 21, 11:02 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.