mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2025-02-21 12:51:01 +00:00
commit
1c14aceb4f
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user