Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
  • Loading branch information
Gold856 and rzblue committed Oct 3, 2024
1 parent de864a9 commit d605954
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wpiutil/src/main/native/cpp/FileLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <utility>

#include "wpi/StringExtras.h"
#include "wpi/print.h"

namespace wpi {
FileLogger::FileLogger(std::string_view file,
Expand All @@ -29,9 +28,9 @@ FileLogger::FileLogger(std::string_view file,
inotify_add_watch(m_inotifyHandle, file.data(), IN_MODIFY)},
m_thread{[=, this] {
char buf[4000];
struct inotify_event ev;
char eventBuf[sizeof(struct inotify_event) + NAME_MAX + 1];
lseek(m_fileHandle, 0, SEEK_END);
while (read(m_inotifyHandle, &ev, sizeof(ev)) > 0) {
while (read(m_inotifyHandle, eventBuf, sizeof(eventBuf)) > 0) {
int bufLen = read(m_fileHandle, buf, sizeof(buf));
while (bufLen > 0) {
callback(std::string_view{buf, static_cast<size_t>(bufLen)});
Expand Down

0 comments on commit d605954

Please sign in to comment.