diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc index b78568d1..fc777a60 100644 --- a/src/client/linux/handler/exception_handler.cc +++ b/src/client/linux/handler/exception_handler.cc @@ -86,6 +86,7 @@ #include #include +#include "common/basictypes.h" #include "common/linux/linux_libc_support.h" #include "common/memory.h" #include "client/linux/log/log.h" @@ -574,7 +575,7 @@ bool ExceptionHandler::WriteMinidump() { // Reposition the FD to its beginning and resize it to get rid of the // previous minidump info. lseek(minidump_descriptor_.fd(), 0, SEEK_SET); - static_cast(ftruncate(minidump_descriptor_.fd(), 0)); + ignore_result(ftruncate(minidump_descriptor_.fd(), 0)); } // Allow this process to be dumped. diff --git a/src/common/basictypes.h b/src/common/basictypes.h index 84668b79..9426c1f6 100644 --- a/src/common/basictypes.h +++ b/src/common/basictypes.h @@ -38,4 +38,21 @@ void operator=(const TypeName&) #endif // DISALLOW_COPY_AND_ASSIGN +namespace google_breakpad { + +// Used to explicitly mark the return value of a function as unused. If you are +// really sure you don't want to do anything with the return value of a function +// that has been marked with __attribute__((warn_unused_result)), wrap it with +// this. Example: +// +// scoped_ptr my_var = ...; +// if (TakeOwnership(my_var.get()) == SUCCESS) +// ignore_result(my_var.release()); +// +template +inline void ignore_result(const T&) { +} + +} // namespace google_breakpad + #endif // COMMON_BASICTYPES_H_