Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix warning and crash #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

LubinLew
Copy link

Warning

build on ubuntu 24.04(x64) Server.

src/iface.cc: In static member function ‘static int ndppd::iface::poll_all()’:
src/iface.cc:667:90: warning: ignoring return value of ‘const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  667 |                 logger::error() << "Failed to read from interface '%s'", ifa->_name.c_str();
      |                                                                          ~~~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/13/string:54,
                 from src/iface.cc:38:
/usr/include/c++/13/bits/basic_string.h:2595:7: note: declared here
 2595 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
src/iface.cc:706:90: warning: ignoring return value of ‘const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’, declared with attribute ‘nodiscard’ [-Wunused-result]
  706 |                 logger::error() << "Failed to read from interface '%s'", ifa->_name.c_str();
      |                                                                          ~~~~~~~~~~~~~~~~^~
/usr/include/c++/13/bits/basic_string.h:2595:7: note: declared here
 2595 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
g++ -c  -O3 -o src/proxy.o src/proxy.cc
g++ -c  -O3 -o src/address.o src/address.cc
g++ -c  -O3 -o src/rule.o src/rule.cc
g++ -c  -O3 -o src/session.o src/session.cc
src/session.cc: In member function ‘void ndppd::session::handle_auto_wire(const ndppd::address&, const std::string&, bool)’:
src/session.cc:212:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  212 |         system(route_cmd.str().c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
src/session.cc:236:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  236 |         system(route_cmd.str().c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
src/session.cc: In member function ‘void ndppd::session::handle_auto_unwire(const std::string&)’:
src/session.cc:264:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  264 |         system(route_cmd.str().c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
src/session.cc:280:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  280 |         system(route_cmd.str().c_str());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Error

When rule is static,ru->daughter() may be nullptr.

ru->daughter()->name() == ifname)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant