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
F81662686: D15618.diff
Fri, Apr 19, 3:30 PM
Unknown Object (File)
Sun, Apr 14, 2:20 AM
Unknown Object (File)
Sat, Apr 13, 10:00 PM
Unknown Object (File)
Jan 27 2024, 1:13 AM
Unknown Object (File)
Jan 27 2024, 1:13 AM
Unknown Object (File)
Jan 27 2024, 1:10 AM
Unknown Object (File)
Jan 27 2024, 1:10 AM
Unknown Object (File)
Jan 27 2024, 1:00 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.