forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: add UV_PIPE_NO_TRUNCATE for bind in pipe_wrap.cc
PR-URL: nodejs#52347 Reviewed-By: Daeyeon Jeong <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
- Loading branch information
Showing
3 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const net = require('net'); | ||
const fs = require('fs'); | ||
const tmpdir = require('../common/tmpdir'); | ||
tmpdir.refresh(); | ||
|
||
// Test UV_PIPE_NO_TRUNCATE | ||
|
||
// See pipe_overlong_path in https://github.com/libuv/libuv/blob/master/test/test-pipe-bind-error.c | ||
if (common.isWindows) { | ||
common.skip('UV_PIPE_NO_TRUNCATE is not supported on window'); | ||
} | ||
|
||
// See https://github.com/libuv/libuv/issues/4231 | ||
const pipePath = `${tmpdir.path}/${'x'.repeat(10000)}.sock`; | ||
|
||
const server = net.createServer() | ||
.listen(pipePath) | ||
// It may work on some operating systems | ||
.on('listening', () => { | ||
// The socket file must exsit | ||
assert.ok(fs.existsSync(pipePath)); | ||
const socket = net.connect(pipePath, common.mustCall(() => { | ||
socket.destroy(); | ||
server.close(); | ||
})); | ||
}) | ||
.on('error', (error) => { | ||
assert.ok(error.code === 'EINVAL', error.message); | ||
net.connect(pipePath) | ||
.on('error', common.mustCall((error) => { | ||
assert.ok(error.code === 'EINVAL', error.message); | ||
})); | ||
}); |