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
|
- name: Create Build Environment
|
||||||
run: |
|
run: |
|
||||||
pip3 install absl-py
|
pip3 install absl-py clang
|
||||||
cmake -E make_directory ${{runner.workspace}}/build
|
cmake -E make_directory ${{runner.workspace}}/build
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
|
|
|
@ -35,6 +35,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2/util:fileops",
|
"//sandboxed_api/sandbox2/util:fileops",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flags",
|
"//sandboxed_api/util:flags",
|
||||||
|
"@com_google_absl//absl/base:core_headers",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include "absl/base/macros.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "sandboxed_api/util/flag.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
|
@ -62,13 +63,10 @@ void Server(int port) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if (int enable = 1; setsockopt(s.get(), SOL_SOCKET, SO_REUSEADDR, &enable,
|
||||||
int enable = 1;
|
sizeof(enable)) < 0) {
|
||||||
if (setsockopt(s.get(), SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) <
|
PLOG(ERROR) << "setsockopt(SO_REUSEADDR) failed";
|
||||||
0) {
|
return;
|
||||||
PLOG(ERROR) << "setsockopt(SO_REUSEADDR) failed";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen to localhost only.
|
// Listen to localhost only.
|
||||||
|
@ -80,12 +78,14 @@ void Server(int port) {
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
LOG(ERROR) << "inet_pton() failed";
|
LOG(ERROR) << "inet_pton() failed";
|
||||||
return;
|
return;
|
||||||
} else if (err == -1) {
|
}
|
||||||
|
if (err == -1) {
|
||||||
PLOG(ERROR) << "inet_pton() failed";
|
PLOG(ERROR) << "inet_pton() failed";
|
||||||
return;
|
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";
|
PLOG(ERROR) << "bind() failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,10 @@ void Server(int port) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char msg[] = "Hello World\n";
|
constexpr char kMsg[] = "Hello World\n";
|
||||||
write(client.get(), msg, strlen(msg));
|
if (write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg) - 1) < 0) {
|
||||||
|
PLOG(ERROR) << "write() failed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConnectToServer(int port) {
|
int ConnectToServer(int port) {
|
||||||
|
@ -121,7 +123,8 @@ int ConnectToServer(int port) {
|
||||||
LOG(ERROR) << "inet_pton() failed";
|
LOG(ERROR) << "inet_pton() failed";
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (err == -1) {
|
}
|
||||||
|
if (err == -1) {
|
||||||
PLOG(ERROR) << "inet_pton() failed";
|
PLOG(ERROR) << "inet_pton() failed";
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -31,6 +31,7 @@ cc_binary(
|
||||||
"//sandboxed_api/sandbox2/util:fileops",
|
"//sandboxed_api/sandbox2/util:fileops",
|
||||||
"//sandboxed_api/sandbox2/util:runfiles",
|
"//sandboxed_api/sandbox2/util:runfiles",
|
||||||
"//sandboxed_api/util:flags",
|
"//sandboxed_api/util:flags",
|
||||||
|
"@com_google_absl//absl/base:core_headers",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include "absl/base/macros.h"
|
||||||
#include "sandboxed_api/util/flag.h"
|
#include "sandboxed_api/util/flag.h"
|
||||||
#include "sandboxed_api/sandbox2/comms.h"
|
#include "sandboxed_api/sandbox2/comms.h"
|
||||||
#include "sandboxed_api/sandbox2/executor.h"
|
#include "sandboxed_api/sandbox2/executor.h"
|
||||||
|
@ -102,8 +103,10 @@ void Server(int port) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char kMsg[] = "Hello World\n";
|
constexpr char kMsg[] = "Hello World\n";
|
||||||
write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg));
|
if (write(client.get(), kMsg, ABSL_ARRAYSIZE(kMsg) - 1) < 0) {
|
||||||
|
PLOG(ERROR) << "write() failed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool ValidateStartMode(const char*, const std::string& flag) {
|
||||||
GlobalForkserverStartModeSet unused;
|
GlobalForkserverStartModeSet unused;
|
||||||
std::string error;
|
std::string error;
|
||||||
if (!AbslParseFlag(flag, &unused, &error)) {
|
if (!AbslParseFlag(flag, &unused, &error)) {
|
||||||
SAPI_RAW_LOG(ERROR, "%s", error);
|
SAPI_RAW_LOG(ERROR, "%s", error.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user