nvwa/0005-nvwa-move-unix-socket-from-run-to-run-nvwa.patch
anatasluo 3299128568 add necessary patches from version 0.2
Including following update:
1. do kexec load before criu dump
2. move nvwa socket from tmp to run
3. kexec add x
4. move pin tool from tools to tools/pin

Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-07-31 14:26:48 +08:00

64 lines
1.4 KiB
Diff

From ae05433278739b1faafef7e18debccefc920c046 Mon Sep 17 00:00:00 2001
From: anatasluo <luolongjuna@gmail.com>
Date: Wed, 31 Mar 2021 15:37:52 +0800
Subject: [PATCH 11/20] nvwa: move unix socket from /run to /run/nvwa
Signed-off-by: anatasluo <luolongjuna@gmail.com>
---
src/main.go | 2 +-
src/server.go | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/main.go b/src/main.go
index d139f78..bcb5bb4 100644
--- a/src/main.go
+++ b/src/main.go
@@ -4,7 +4,7 @@ import (
"flag"
)
-var socketPath = "/run/nvwa.socket"
+var socketPath = "/run/nvwa/nvwa.socket"
func main() {
server := flag.Int("server", 0,
diff --git a/src/server.go b/src/server.go
index 1185789..3de06a5 100644
--- a/src/server.go
+++ b/src/server.go
@@ -6,6 +6,7 @@ import (
"net"
"os"
"path"
+ "path/filepath"
"reflect"
"runtime"
"strconv"
@@ -431,12 +432,23 @@ func ExitServer(msg string) int {
return 0
}
+func may_init_socket(path string) error {
+ socketDir := filepath.Dir(path)
+ log.Debugf("Socket directory %s \n", socketDir)
+ return os.Mkdir(socketDir, 0700)
+}
+
func runServer(path string) {
registerRPC("update", UpdateImage)
registerRPC("restore", RestoreService)
registerRPC("init", InitEnv)
registerRPC("exit", ExitServer)
+ err := may_init_socket(path)
+ if err != nil {
+ log.Fatal(err)
+ }
+
addr, err := net.ResolveUnixAddr("unix", path)
if err != nil {
log.Fatal(err)
--
2.31.1