only unlink socketpath if indeed it is a socket, prevent stupid
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
60eefe0248
commit
b0d286c4ab
|
|
@ -342,7 +342,10 @@ logger.info(
|
||||||
let socketPath = bindSocket;
|
let socketPath = bindSocket;
|
||||||
socketPath = socketPath.replace(/^unix:\/\//g, "");
|
socketPath = socketPath.replace(/^unix:\/\//g, "");
|
||||||
if (socketPath && fs.existsSync(socketPath)) {
|
if (socketPath && fs.existsSync(socketPath)) {
|
||||||
fs.unlinkSync(socketPath);
|
let fsStat = fs.statSync(socketPath);
|
||||||
|
if (fsStat.isSocket()) {
|
||||||
|
fs.unlinkSync(socketPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process.exit(code);
|
process.exit(code);
|
||||||
|
|
@ -373,7 +376,10 @@ if (require.main === module) {
|
||||||
let socketPath = bindSocket;
|
let socketPath = bindSocket;
|
||||||
socketPath = socketPath.replace(/^unix:\/\//g, "");
|
socketPath = socketPath.replace(/^unix:\/\//g, "");
|
||||||
if (socketPath && fs.existsSync(socketPath)) {
|
if (socketPath && fs.existsSync(socketPath)) {
|
||||||
fs.unlinkSync(socketPath);
|
let fsStat = fs.statSync(socketPath);
|
||||||
|
if (fsStat.isSocket()) {
|
||||||
|
fs.unlinkSync(socketPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ const package = require("../package.json");
|
||||||
args.version = package.version;
|
args.version = package.version;
|
||||||
|
|
||||||
const protoLoader = require("@grpc/proto-loader");
|
const protoLoader = require("@grpc/proto-loader");
|
||||||
const csiVersion = process.env.CSI_VERSION || args.csiVersion || "1.2.0";
|
const csiVersion = process.env.CSI_VERSION || args.csiVersion || "1.5.0";
|
||||||
const PROTO_PATH = __dirname + "/../csi_proto/csi-v" + csiVersion + ".proto";
|
const PROTO_PATH = __dirname + "/../csi_proto/csi-v" + csiVersion + ".proto";
|
||||||
|
|
||||||
// Suggested options for similarity to existing grpc.load behavior
|
// Suggested options for similarity to existing grpc.load behavior
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue