!1511 修改appspawn 蓝黄不一致代码

Merge pull request !1511 from 樊景乐/master
This commit is contained in:
openharmony_ci 2024-10-12 08:29:12 +00:00 committed by Gitee
commit 1c14aceb4f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 1 additions and 10 deletions

View File

@ -51,7 +51,6 @@ extern "C" {
#define APPSPAWN_MSG_DIR APPSPAWN_BASE_DIR "/mnt/startup/"
#endif
#define DEVICE_VIRTUAL_NET_IO_DIR "/sys/devices/virtual/net/lo/"
#define DEVICE_VIRTUAL_NET_IO_FLAGS "/sys/devices/virtual/net/lo/flags"
#define IFF_LOOPBACK_VALUE "9\n"
#define IFF_LOOPBACK_SIZE 2

View File

@ -424,15 +424,7 @@ uint32_t GetSpawnTimeout(uint32_t def)
int EnableNewNetNamespace(void)
{
int fd = open(DEVICE_VIRTUAL_NET_IO_FLAGS, O_WRONLY);
if (fd < 0) {
// avoid open DEVICE_VIRTUAL_NET_IO_FLAGS fail, retry
DIR *pDir = opendir(DEVICE_VIRTUAL_NET_IO_DIR);
if (pDir != NULL) {
closedir(pDir);
}
fd = open(DEVICE_VIRTUAL_NET_IO_FLAGS, O_WRONLY);
APPSPAWN_CHECK(fd >= 0, return APPSPAWN_SYSTEM_ERROR, "Failed to open file errno %{public}d", errno);
}
APPSPAWN_CHECK(fd >= 0, return APPSPAWN_SYSTEM_ERROR, "Failed to open file errno %{public}d", errno);
int ret = write(fd, IFF_LOOPBACK_VALUE, IFF_LOOPBACK_SIZE);
if (ret < 0) {