common: trim null bytes from filename in readNotifyAsync()

readNotifyAsync() uses inotify_event to monitor filesystem changes.
The name field in inotify_event contains a null-terminated name, and
may include additional null bytes to pad the structure for alignment as
mentioned in [1] inotify(7).

If the padded name (including extra null bytes) is passed directly to
processUpdate(), the comparison against the expected filename will
fail, even when the visible parts of the names match.

This change ensures the filename is trimmed at the first null byte
before being passed to processUpdate(), preventing false mismatches
and ensuring correct processing.

Tested on Yosemite5, and confirmed that the BIOS version is retrieved
correctly when host0_bios_version.txt is created.

[1] https://www.man7.org/linux/man-pages/man7/inotify.7.html

Change-Id: Ic0ccd7f4e163eb650baa65045c9af1e7be01964b
Signed-off-by: Kevin Tung <kevin.tung.openbmc@gmail.com>
1 file changed
tree: 47479b3618e652df7b5bf336a83275fa8f306111
  1. bios/
  2. bmc/
  3. common/
  4. cpld/
  5. eeprom-device/
  6. i2c-vr/
  7. subprojects/
  8. test/
  9. .clang-format
  10. .clang-tidy
  11. .gitignore
  12. .shellcheck
  13. LICENSE
  14. meson.build
  15. meson.options
  16. OWNERS
  17. README.md
README.md

phosphor-bmc-code-mgmt

Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture

To Build

To build this package, do the following steps:

  1. meson build
  2. ninja -C build

To clean the repository run rm -r build.