Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netconsd: Fix printing of uint64_t's in modules
Summary: Building on arm64 currently warns with ``` logger.cc: In function 'void write_log(logtarget&, msg_buf*, ncrx_msg*)': logger.cc:121:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=] dprintf(tgt.fd, "%06lu %014lu %d %d %s%s%s%s%s\n", msg->seq, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ logger.cc:121:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=] g++ logger.o -lpthread -lrt -ldl -shared -static-libstdc++ -static-libgcc \ -o logger.so ``` It also segfaults as soon as it gets an extended message, due to the %lu trying to read 8 bytes, while the argument is just 4. Use a portable type to make the build dtrt on x86-64 and arm64 Reviewed By: davide125 Differential Revision: D30970654 fbshipit-source-id: 6edc47d48486e2f66644bbec6405024d8e948cad
- Loading branch information