Fix compile errors on ubuntu 20.04 (#4931)

This commit is contained in:
Binglin Chang 2022-04-21 01:00:46 +08:00 committed by GitHub
parent 5df3bac110
commit 408c0cf1c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 12 deletions

View File

@ -2635,7 +2635,11 @@ void print_report(mako_args_t* args,
fseek(f, 0, 0); fseek(f, 0, 0);
index = 0; index = 0;
while (index < numPoints) { while (index < numPoints) {
fread(&dataPoints[op][k++], sizeof(uint64_t), 1, f); size_t nread = fread(&dataPoints[op][k++], sizeof(uint64_t), 1, f);
if (nread != 1) {
fprintf(stderr, "ERROR: read failed\n");
exit(1);
}
++index; ++index;
} }
fclose(f); fclose(f);
@ -2759,7 +2763,11 @@ void print_report(mako_args_t* args,
char command_remove[NAME_MAX] = { '\0' }; char command_remove[NAME_MAX] = { '\0' };
sprintf(command_remove, "rm -rf %s%d", TEMP_DATA_STORE, *pid_main); sprintf(command_remove, "rm -rf %s%d", TEMP_DATA_STORE, *pid_main);
system(command_remove); int ret = system(command_remove);
if (ret != 0) {
fprintf(stderr, "ERROR: system() call failed\n");
exit(ret);
}
for (op = 0; op < MAX_OP; op++) { for (op = 0; op < MAX_OP; op++) {
if (args->txnspec.ops[op][OP_COUNT] > 0 || op == OP_TRANSACTION) { if (args->txnspec.ops[op][OP_COUNT] > 0 || op == OP_TRANSACTION) {

View File

@ -406,21 +406,21 @@ TransportData::TransportData(uint64_t transportId, int maxWellKnownEndpoints, IP
struct ConnectPacket { struct ConnectPacket {
// The value does not include the size of `connectPacketLength` itself, // The value does not include the size of `connectPacketLength` itself,
// but only the other fields of this structure. // but only the other fields of this structure.
uint32_t connectPacketLength; uint32_t connectPacketLength = 0;
ProtocolVersion protocolVersion; // Expect currentProtocolVersion ProtocolVersion protocolVersion; // Expect currentProtocolVersion
uint16_t canonicalRemotePort; // Port number to reconnect to the originating process uint16_t canonicalRemotePort = 0; // Port number to reconnect to the originating process
uint64_t connectionId; // Multi-version clients will use the same Id for both connections, other connections will uint64_t connectionId = 0; // Multi-version clients will use the same Id for both connections, other connections
// set this to zero. Added at protocol Version 0x0FDB00A444020001. // will set this to zero. Added at protocol Version 0x0FDB00A444020001.
// IP Address to reconnect to the originating process. Only one of these must be populated. // IP Address to reconnect to the originating process. Only one of these must be populated.
uint32_t canonicalRemoteIp4; uint32_t canonicalRemoteIp4 = 0;
enum ConnectPacketFlags { FLAG_IPV6 = 1 }; enum ConnectPacketFlags { FLAG_IPV6 = 1 };
uint16_t flags; uint16_t flags = 0;
uint8_t canonicalRemoteIp6[16]; uint8_t canonicalRemoteIp6[16] = { 0 };
ConnectPacket() { memset(this, 0, sizeof(*this)); } ConnectPacket() = default;
IPAddress canonicalRemoteIp() const { IPAddress canonicalRemoteIp() const {
if (isIPv6()) { if (isIPv6()) {

View File

@ -242,7 +242,9 @@ ACTOR Future<int> spawnProcess(std::string binPath,
static auto fork_child(const std::string& path, std::vector<char*>& paramList) { static auto fork_child(const std::string& path, std::vector<char*>& paramList) {
int pipefd[2]; int pipefd[2];
pipe(pipefd); if (pipe(pipefd) != 0) {
return std::make_pair(-1, Optional<int>{});
}
auto readFD = pipefd[0]; auto readFD = pipefd[0];
auto writeFD = pipefd[1]; auto writeFD = pipefd[1];
pid_t pid = fork(); pid_t pid = fork();

View File

@ -663,7 +663,7 @@ static void printUsage(const char* name, bool devhelp) {
" collector_endpoint -- IP:PORT of the fluentd server\n" " collector_endpoint -- IP:PORT of the fluentd server\n"
" collector_protocol -- UDP or TCP (default is UDP)"); " collector_protocol -- UDP or TCP (default is UDP)");
#ifndef TLS_DISABLED #ifndef TLS_DISABLED
printf(TLS_HELP); printf("%s", TLS_HELP);
#endif #endif
printOptionUsage("-v, --version", "Print version information and exit."); printOptionUsage("-v, --version", "Print version information and exit.");
printOptionUsage("-h, -?, --help", "Display this help and exit."); printOptionUsage("-h, -?, --help", "Display this help and exit.");