mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Follow-up with more build fixes
Because any change that touches continuous integration needs a companion o.O PiperOrigin-RevId: 347769780 Change-Id: I20525aaac2ce41c48f619b641baa31e880432e50
This commit is contained in:
parent
07d4d02628
commit
507010781a
2
.github/workflows/ubuntu-cmake.yml
vendored
2
.github/workflows/ubuntu-cmake.yml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
|||
|
||||
- name: Create Build Environment
|
||||
run: |
|
||||
pip3 install absl-py
|
||||
pip3 install absl-py clang
|
||||
cmake -E make_directory ${{runner.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
|
|
|
@ -35,6 +35,7 @@ cc_binary(
|
|||
"//sandboxed_api/sandbox2/util:fileops",
|
||||
"//sandboxed_api/sandbox2/util:runfiles",
|
||||
"//sandboxed_api/util:flags",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <string>
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include "absl/base/macros.h"
|
||||
#include "sandboxed_api/util/flag.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/sandbox2/executor.h"
|
||||
|
@ -62,14 +63,11 @@ void Server(int port) {
|
|||
return;
|
||||
}
|
||||
|
||||
{
|
||||
int enable = 1;
|
||||
if (setsockopt(s.get(), SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) <
|
||||
0) {
|
||||
if (int enable = 1; setsockopt(s.get(), SOL_SOCKET, SO_REUSEADDR, &enable,
|
||||
sizeof(enable)) < 0) {
|
||||
PLOG(ERROR) << "setsockopt(SO_REUSEADDR) failed";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Listen to localhost only.
|
||||
struct sockaddr_in6 addr = {};
|
||||
|
@ -80,12 +78,14 @@ void Server(int port) {
|
|||
if (err == 0) {
|
||||
LOG(ERROR) << "inet_pton() failed";
|
||||
return;
|
||||
} else if (err == -1) {
|
||||
}
|
||||
if (err == -1) {
|
||||
PLOG(ERROR) << "inet_pton() failed";
|
||||
return;
|
||||
}
|
||||
|
||||
if (bind(s.get(), (struct sockaddr*)&addr, sizeof(addr)) < 0) {
|
||||
if (bind(s.get(), reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) <
|
||||
0) {
|
||||
PLOG(ERROR) << "bind() failed";
|
||||
return;
|
||||
}
|
||||
|
@ -101,8 +101,10 @@ void Server(int port) {
|
|||
return;
|
||||
}
|
||||
|
||||
const char msg[] = "Hello World\n";
|
||||
write(client.get(), msg, strlen(msg));
|
||||
constexpr char kMsg[] = "Hello World\n";
|
||||
if (write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg) - 1) < 0) {
|
||||
PLOG(ERROR) << "write() failed";
|
||||
}
|
||||
}
|
||||
|
||||
int ConnectToServer(int port) {
|
||||
|
@ -121,7 +123,8 @@ int ConnectToServer(int port) {
|
|||
LOG(ERROR) << "inet_pton() failed";
|
||||
close(s);
|
||||
return -1;
|
||||
} else if (err == -1) {
|
||||
}
|
||||
if (err == -1) {
|
||||
PLOG(ERROR) << "inet_pton() failed";
|
||||
close(s);
|
||||
return -1;
|
||||
|
|
|
@ -31,6 +31,7 @@ cc_binary(
|
|||
"//sandboxed_api/sandbox2/util:fileops",
|
||||
"//sandboxed_api/sandbox2/util:runfiles",
|
||||
"//sandboxed_api/util:flags",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include "absl/base/macros.h"
|
||||
#include "sandboxed_api/util/flag.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/sandbox2/executor.h"
|
||||
|
@ -102,8 +103,10 @@ void Server(int port) {
|
|||
return;
|
||||
}
|
||||
|
||||
const char kMsg[] = "Hello World\n";
|
||||
write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg));
|
||||
constexpr char kMsg[] = "Hello World\n";
|
||||
if (write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg) - 1) < 0) {
|
||||
PLOG(ERROR) << "write() failed";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -77,7 +77,7 @@ bool ValidateStartMode(const char*, const std::string& flag) {
|
|||
GlobalForkserverStartModeSet unused;
|
||||
std::string error;
|
||||
if (!AbslParseFlag(flag, &unused, &error)) {
|
||||
SAPI_RAW_LOG(ERROR, "%s", error);
|
||||
SAPI_RAW_LOG(ERROR, "%s", error.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user