Commit Graph

4148 Commits

Author SHA1 Message Date
Tony Theodore
9386f2ca94 build, mingw: set LIBS in configure.ac
Instead of doing it instead Makefile.am, this fixes libuv.pc on MinGW.

Previous version generates libuv.pc with LIBS = "-lpthread" instead of
"-lpthread -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv" on MinGW.

Previous version generates the following Makefile.am:

    am__append_4 = -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv
    ...
    LIBS = -lpthread  $(am__append_4)

and the following configure.ac:

    AS_IF([test "x$PKG_CONFIG" != "x"], [
        AC_CONFIG_FILES([libuv.pc])
    ])
    AC_CONFIG_FILES([Makefile])

Therefore, Makefile is generated after libuv.pc. Variables from
Makefile don't affect config.status and libuv.pc.

PR-URL: https://github.com/libuv/libuv/pull/841
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-05-05 23:27:31 +02:00
Imran Iqbal
337e9fd0f5 test: fix POLLHDRUP related failures for AIX
`POLLHDRUP` is not implemented on AIX. Therefore `UV_DISCONNECT` will
never be set on `events`. This causes the socket to never be closed and
the tests to be stuck inside `pollset_poll` indefinitely, resulting in a
timeout.

This fixes the following tests:
- poll_duplex
- poll_unidirectional

Updated docs to let end users know that `UV_DISCONNECT` can be set, but
is unsupported on AIX.

Fixes: https://github.com/libuv/libuv/issues/844
PR-URL: https://github.com/libuv/libuv/pull/857
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-05-05 23:23:28 +02:00
Saúl Ibarra Corretgé
d43ee0eafa win: clarify fsevents handling code
The code for handling fs events is quite complex, this commits tries to
make it easier to follow.

First, there are 2 cases in which we use the name of the file straight
from the event (when watching a directory):

- if we cannot create the long path
- if the file got renamed or removed

So separate this logically, even if the code we need is the same.

Second, one way or anothwer we will always have some filename to report,
so remove an unnecessary if.

Third, nullify filenamew, to avoid having a dangling pointer, should the
code change.

PR-URL: https://github.com/libuv/libuv/pull/858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-05-05 19:36:44 +01:00
Ben Noordhuis
2753bc1fc8 test: fix -Wformat warnings in platform test
Cast the `ru_majflt` and `ru_maxrss` field to `unsigned long long` when
printing them with `"%llu"`.

Warnings introduced in commit 6f17a61 ("win: add maxrss, pagefaults to
uv_getrusage()".)

PR-URL: https://github.com/libuv/libuv/pull/855
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-05-04 17:25:21 +02:00
Ben Noordhuis
4844c75de8 build: always compile with -fvisibility=hidden
The 'visibility%' gyp variable was designed as an override mechanism for
old (<=3.4) versions of gcc that don't know about -fvisibility=hidden.

It turns out it's fairly easy for embedders to muck up the define, as
witnessed by the fact that node.js is currently leaking internal libuv
symbols due to not properly setting 'visibility%'.

While that could be fixed by tweaking node.js, because we don't support
gcc 3.4 anymore and haven't for a long time, making -fvisibility=hidden
the default here seems all around easier.

PR-URL: https://github.com/libuv/libuv/pull/847
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-29 17:03:16 +02:00
Kári Tristan Helgason
4b342554b5 build: bump android ndk version
PR-URL: https://github.com/libuv/libuv/pull/790
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-26 09:37:47 +02:00
Kári Tristan Helgason
f57bfd4dca unix: fix bug in barrier fallback implementation
There was a memory corruption issue with the pthread barrier
implementation on android, where a barrier could still be in use by one
thread when being freed by another.

This fixes that issue and adds lots of missing error handling.

This implementation is now also used for the OSX fallback.

Fixes: https://github.com/libuv/libuv/issues/615
PR-URL: https://github.com/libuv/libuv/pull/790
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-26 09:35:47 +02:00
Myles Borins
f617ccc644 unix: error on realpath if PATH_MAX is undefined
Currently when PATH_MAX is undefined realpath will default to using 4096.
There is a potential stack overflow attack that can be mitigated by having
PATH_MAX defined. This change conservatively errors if a system does not
have PATH_MAX defined.

This change also explicitly includes `limits.h` to ensure that all platforms
have PATH_MAX defined if it is available.

Ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Refs: https://github.com/nodejs/node/issues/2680#issuecomment-213521708
PR-URL: https://github.com/libuv/libuv/pull/843
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-26 09:22:47 +02:00
Andrius Bentkus
5c6c268182 test: set a big send buffer size for tcp_write_queue_order
We set the maximum buffer size of the client socket to a specific
value so unreasonable OS settings won't trigger assert failures.

Fixes: https://github.com/libuv/libuv/issues/764
Refs: https://github.com/libuv/libuv/pull/767
PR-URL: https://github.com/libuv/libuv/pull/768
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-21 20:28:33 +02:00
Robert Jefe Lindstaedt
6f17a617da win: add maxrss, pagefaults to uv_getrusage()
This commit populates the ru_majflt and ru_maxrss fields of
uv_getrusage() on Windows.

PR-URL: https://github.com/libuv/libuv/pull/805
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-21 10:44:08 -04:00
Imran Iqbal
faea76d81d test: skip fs_event_close_in_callback on AIX
The file descriptor that you receive from ahafs has to be part of the
pollset_poll set of interest in order to receive events. This does not
happen until we are in the event loop causing the test to hang and
therefore timeout.

PR-URL: https://github.com/libuv/libuv/pull/838
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-20 12:23:17 +02:00
Ben Noordhuis
b9324acb75 unix: remove unneeded SAVE_ERRNO wrappers
uv__close() won't clobber errno so there is no need to guard calls with
a SAVE_ERRNO(...) wrapper.

PR-URL: https://github.com/libuv/libuv/pull/837
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-18 13:38:23 +02:00
Ben Noordhuis
322de63a9b unix: guard against clobbering errno in uv__free()
Libuv expects that free() does not clobber errno.  The system allocator
honors that assumption but custom allocators may not be so careful.

PR-URL: https://github.com/libuv/libuv/pull/837
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-18 13:38:04 +02:00
Ben Noordhuis
d03abfd400 win: work around sharepoint scandir bug
It has been reported that for SharePoint connections mapped as a drive,
uv_fs_scandir() returns "." and ".." entries when the expectation is
that they should be filtered out.

After some investigation it looks like the driver returns ".\0" and
"..\0" for those entries, that is, it includes the zero byte in the
filename length.  Rewrite the filter to catch those entries as well.

Fixes: https://github.com/nodejs/node/issues/4002
PR-URL: https://github.com/libuv/libuv/pull/636
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-15 17:11:53 +02:00
Oguz Bastemur
70d5014266 android: pthread_sigmask() does not set errno
Originally intended workaround is especially needed for Android <4.4.
However it fails to compare errno collected from pthread_sigmask.

This has been fixed separately in JXcore. See issue:
https://github.com/jxcore/jxcore-cordova/issues/55

PR-URL: https://github.com/libuv/libuv/pull/833
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-15 12:21:49 +02:00
Ben Noordhuis
4a5b3f982e unix: delay signal handling until after normal i/o
It was reported that some node.js tests fail on AIX because the exit
event sometimes comes before the final stdio output of a child process.

Work around that by deferring the signal watcher that is used for
process management until after the dispatch of regular i/o watchers.

Fixes: https://github.com/libuv/libuv/issues/610
PR-URL: https://github.com/libuv/libuv/pull/611
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-15 12:04:57 +02:00
Imran Iqbal
572d31599f unix,fs: code cleanup of uv_fs_event_start for AIX
Remove unused variables and code. Also remove some code duplication. End
result is code is cleaner, readable and easier to step through when
debugging.

PR-URL: https://github.com/libuv/libuv/pull/825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-14 21:22:03 +02:00
Imran Iqbal
f28a11229f test: fix fs_event_watch_file_current_dir for AIX
PR-URL: https://github.com/libuv/libuv/pull/828
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-13 11:39:00 +02:00
Ben Noordhuis
60ef1e7f13 linux: fix long lines in linux-core.c
Introduced in commit 6798876a, "linux: fix cpu count".

PR-URL: https://github.com/libuv/libuv/pull/822
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-12 21:21:56 +02:00
Ben Noordhuis
732fb03ac6 linux: don't abort on malformed /proc/stat
Return an error instead of aborting when /proc/stat doesn't have the
expected format.

PR-URL: https://github.com/libuv/libuv/pull/822
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-12 21:21:55 +02:00
Ben Noordhuis
2bf7b3855c linux: fix fd leaks in uv_cpu_info() error paths
Introduced in commit 6798876a, "linux: fix cpu count".

PR-URL: https://github.com/libuv/libuv/pull/822
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-12 21:21:37 +02:00
cjihrig
be8e237a8e Revert "win,build: remove unused build defines"
This reverts commit 60db5b5a1b.
Removing the WIN32_LEAN_AND_MEAN definition caused build errors
on mingw64.

Fixes: https://github.com/libuv/libuv/issues/820
PR-URL: https://github.com/libuv/libuv/pull/821
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-12 08:37:16 -04:00
Saúl Ibarra Corretgé
341097403d doc: add ability to live reload and regenerate HTML
PR-URL: https://github.com/libuv/libuv/pull/819
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-11 12:52:59 -03:00
Ben Noordhuis
375ba2d76d unix: use POLL{IN,OUT,etc} constants directly
Remove the UV__POLL defines and use POLL{IN,OUT,etc} directly.
On Linux, we lean on the fact that the POLL constants correspond
one-to-one to their EPOLL counterparts.

Fixes: https://github.com/libuv/libuv/issues/816
PR-URL: https://github.com/libuv/libuv/pull/817
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-11 10:51:13 +02:00
Michael Fero
3819e48277 win: fix var declaration to be C89 compliant
Visual Studio 2013+ relaxed variable declaration C89 compliance; older
compilers are strict (e.g. VS 2008 - 2012).

PR-URL: https://github.com/libuv/libuv/pull/815
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-10 10:00:54 -03:00
Saúl Ibarra Corretgé
7acb6bd843 test: skip early bind tests if no IPv6 is supported
PR-URL: https://github.com/libuv/libuv/pull/814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-10 09:53:25 -03:00
Imran Iqbal
4aeed1ac13 unix: implement uv__fs_futime for AIX 7.1
'futimens' is only implemented on AIX 7.1.  Other functions like
'utimes' and 'utimes' are merely stub functions that return ENOSYS
on AIX 6.1 and below.  Skip test fs_futime for AIX versions below 7.1.

PR-URL: https://github.com/libuv/libuv/pull/811
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-08 21:08:13 +02:00
cjihrig
a84caf6fd7 test: handle root home directories
Currently, the tests assert that the home directory doesn't end
in a slash. However, if the home directory is / or something like
C:\, then this assertion is incorrect. This commit adds special
handling for these cases.

Fixes: https://github.com/libuv/libuv/issues/812
PR-URL: https://github.com/libuv/libuv/pull/813
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-08 11:08:46 -04:00
Saúl Ibarra Corretgé
d476185bb3 Now working on version 1.9.1 2016-04-07 07:52:59 -03:00
Saúl Ibarra Corretgé
4b444d3fbc Add SHA to ChangeLog 2016-04-07 12:15:02 +02:00
Saúl Ibarra Corretgé
229b3a4cc1 2016.04.08, Version 1.9.0 (Stable)
Changes since version 1.8.0:

* win: wait for full timeout duration (João Reis)

* unix: fix support for uClibc-ng (Martin Bark)

* doc: indicate where new test files need to be added (Dave)

* test,unix: fix logic error in test runner (Ben Noordhuis)

* fs: don't nullify req->bufs on EINTR (Dave)

* osx: set the default thread stack size to RLIMIT_STACK (Saúl Ibarra
  Corretgé)

* build: invoke libtoolize with --copy (Ben Noordhuis)

* test: fixup eintr_handling (Saúl Ibarra Corretgé)

* osx: avoid compilation warning with Clang (Saúl Ibarra Corretgé)

* test,win: fix compilation with shared lib (Alexis Murzeau)

* test: fix race condition in pipe-close-stdout (Imran Iqbal)

* unix,win: add uv_os_tmpdir() (cjihrig)

* ios: fix undefined PTHREAD_STACK_MIN (Didiet)

* test: fix threadpool_multiple_event_loops for AIX (Imran Iqbal)

* unix: report errors for unpollable fds (Ben Noordhuis)

* win: fix watching root files (Nicholas Vavilov)

* build,win: print the Visual Studio version in use (Saúl Ibarra
  Corretgé)

* build,win: remove unneeded condition from GYP file (Saúl Ibarra
  Corretgé)

* test,win: fix compilation warning (Saúl Ibarra Corretgé)

* test: use uv_loop_close and assert its result (Nan Xiang)

* build: map 'AMD64' host arch to 'x64' (Ben Noordhuis)

* osx: protected use of potentially undefined macro (Samuel Lorétan)

* linux: fix compilation with musl (Saúl Ibarra Corretgé)

* doc: describe how to make release builds on Unix (Saúl Ibarra
  Corretgé)

* doc: add missing link in README (Saúl Ibarra Corretgé)

* build: python 2.x/3.x consistent print usage (Rasmus Christian
  Pedersen)

* test: assume no IPv6 if interfaces cannot be listed (Nan Xiang)

* darwin: replace F_FULLFSYNC with fdatasync syscall (Saúl Ibarra
  Corretgé)

* doc: add missing write callback to example (Nándor István Krácser)

* build: compile with -D_THREAD_SAFE on AIX (Imran Iqbal)

* test: fix threadpool_multiple_event_loops on PPC (Imran Iqbal)

* test: reduce timeout in tcp_close_while_connecting (Imran Iqbal)

* unix, win: consistently null-terminate buffers (Saúl Ibarra Corretgé)

* unix, win: count null byte on UV_ENOBUFS (Saúl Ibarra Corretgé)

* test: fix deadlocks in uv_cond_wait (Katsutoshi Horie)

* linux: fix cpu count (Lukasz Jagiello)

* unix: fix uv__handle_type for AIX (Imran Iqbal)

* linux: call fclose(), fix fdopen() memory leak (Ben Noordhuis)

* win: remove unneeded condition (Saúl Ibarra Corretgé)

* unix: fix compile error in Android using bionic (Robert Chiras)

* linux: add braces to multi-statement if (Kári Tristan Helgason)

* doc: add @cjihrig as a maintainer (Saúl Ibarra Corretgé)

* unix: add fork-safe open file function (Kári Tristan Helgason)

* linux: replace calls to fopen with uv__open_file (Kári Tristan
  Helgason)

* linux: remove redundant call to rewind() (Krishnaraj Bhat)

* win: remove duplicated code when processing fsevents (Saúl Ibarra
  Corretgé)

* test: fix poll_bad_fdtype for AIX (Imran Iqbal)

* linux: fix error checking in uv__open_file (Saúl Ibarra Corretgé)

* poll: add UV_DISCONNECT event (Santiago Gimeno)

* fs: realpath: fix string size before converting (Yuval Brik)

* win: use native APIs for UTF conversions (cjihrig)

* doc: clarify uv_loop_close() (Ben Noordhuis)

* unix: retry ioctl(TIOCGWINSZ) on EINTR (Ben Noordhuis)

* win,build: remove unused build defines (Saúl Ibarra Corretgé)

* win: fix buffer overflow in fs events (Joran Dirk Greef)

* win: fix uv_relative_path and remove dead branch (Joran Dirk Greef)

* unix: use open(2) with O_CLOEXEC on OS X (Kári Tristan Helgason)

* test: add missing copyright header (cjihrig)

* aix: fix 'POLLRDHUP undeclared' build error (Ben Noordhuis)

* unix,win: add uv_get_passwd() (cjihrig)

* process: fix uv_spawn edge-case (Santiago Gimeno)

* test: use %ld for printing uid/gid (Ben Noordhuis)

* aix: fix ahafs implementation (Imran Iqbal)

* aix: do not store absolute path to ahafs (Imran Iqbal)

* process: close process pipes safely (Santiago Gimeno)

* unix: open ttyname instead of /dev/tty (Enno Boland)

* unix: remove outdated comment (Kári Tristan Helgason)
2016-04-07 12:14:56 +02:00
Kári Tristan Helgason
7ed5d67133 unix: remove outdated comment
The comment removed by this commit is no longer relevant, as
the function's return type changed from int to void.

PR-URL: https://github.com/libuv/libuv/pull/804
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-04 23:42:10 -04:00
Enno Boland
387102b247 unix: open ttyname instead of /dev/tty
Find the real name of the tty using ttyname_r(3) instead of
opening "/dev/tty" which causes trouble if the fd doesn't point to the
controlling terminal.

PR-URL: https://github.com/libuv/libuv/pull/779
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-01 11:13:22 +02:00
Santiago Gimeno
643c9e9c32 process: close process pipes safely
Use `uv__close__nocheckstdio` instead of `close`.

PR-URL: https://github.com/libuv/libuv/pull/798
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-01 11:01:01 +02:00
Imran Iqbal
6ae622b0a1 aix: do not store absolute path to ahafs
We only need the absolute path to create our .mon file under /aha. So
only duplicate the passed string. This keeps behaviour similar to other
platforms.

Fixes test fs_event_getpath.

PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-01 10:53:27 +02:00
Imran Iqbal
a117fbd13b aix: fix ahafs implementation
uv__makedir_p was not processing all directories in passed string. Now
if a directory already exists (EEXIST) it simply moves onto the next
directory in the provided string.

Fixed bogus assert in uv__ahafs_event.

PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-04-01 10:52:01 +02:00
Ben Noordhuis
2d6437888e test: use %ld for printing uid/gid
The uid and gid fields in uv_passwd_t are of type long so use %ld for
printing them.  Fixes two -Wformat compiler warnings.

PR-URL: https://github.com/libuv/libuv/pull/797
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-31 13:19:53 +02:00
Santiago Gimeno
1c0281e3e2 process: fix uv_spawn edge-case
It can happen that the `parent` end of the `signal_pipe` is given a
STDIO file descriptor, so closing it using `uv__close` fails.

This problem is happening when running the `spawn_closed_process_io`
test in `SmartOS`. The reason being that when creating a socketpair in
`uv__process_init_stdio`, the `Illumos` implementation uses 3 sockets:
one is used as a listener, and the other 2 represent both ends of the
pipe. The listener socket is closed once the pipe is created. In the
test, the listener socket is assigned to the `0` fd, as it is the
first free fd in the system. So the fd `0` remained free after the call
to `socketpair`. Afterwards, when creating the `signal_pipe`, the fd `0`
is being assigned again, so closing it with `uv__close` made the test
fail. This issue is not happening in the other unixes because
`socketpair` doesn't use 3 fd's, but only 2.

To solve the issue, a new `uv__close__nocheckstdio()` function has been
added and used.

PR-URL: https://github.com/libuv/libuv/pull/796
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-31 11:53:42 +02:00
cjihrig
217f81b6a1 unix,win: add uv_get_passwd()
This commit adds the uv_get_passwd() function, which returns a
subset of the current effective user's password file entry.

Refs: https://github.com/libuv/libuv/issues/11
Fixes: https://github.com/libuv/libuv/issues/731
PR-URL: https://github.com/libuv/libuv/pull/742
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-29 08:13:59 -04:00
Ben Noordhuis
27aa81fe5a aix: fix 'POLLRDHUP undeclared' build error
AIX doesn't have POLLRDHUP.  Fixes the following compile-time error:

    src/unix/core.c: In function 'uv__io_start':
    src/unix/core.c:831:40: error: 'POLLRDHUP' undeclared
    assert(0 == (events & ~(UV__POLLIN | UV__POLLOUT | UV__POLLRDHUP)));

Fixes: https://github.com/libuv/libuv/issues/783
PR-URL: https://github.com/libuv/libuv/pull/785
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-03-26 11:31:23 +01:00
cjihrig
13f4dc8288 test: add missing copyright header
This commit adds the copyright header to the two tests that
were missing it.

PR-URL: https://github.com/libuv/libuv/pull/782
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-24 13:17:31 -04:00
Kári Tristan Helgason
02709a947f unix: use open(2) with O_CLOEXEC on OS X
PR-URL: https://github.com/libuv/libuv/pull/753
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-23 14:31:05 +01:00
Joran Dirk Greef
757e3c6071 win: fix uv_relative_path and remove dead branch
wcslen() returns a size_t, not an int.

Add bounds checking to dirlen to avoid undefined if dirlen is 0.

Cache relpath size calculation to replace redundant (- 1 + 1)
expression while still showing workings.

Change uv_relative_path return type to void and remove dead code which
branched on the return value.

PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-23 14:23:47 +01:00
Joran Dirk Greef
b44abe20ef win: fix buffer overflow in fs events
When converting an absolute path to a relative path on Windows,
uv_relative_path assumed that the relative path could be no longer than
MAX_PATH characters, and would allocate a buffer of MAX_PATH characters
for the relative path.

However, where a recursive watch is started for a directory using a UNC
path, and where events within that directory occur for pathnames longer
than MAX_PATH, it is possible for the relative path to exceed MAX_PATH
characters and overflow the buffer.

This commit fixes uv_relative_path to allocate a buffer for the exact
number of characters counted in the relative path.

Fixes: https://github.com/libuv/libuv/issues/693
PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-23 14:23:46 +01:00
Saúl Ibarra Corretgé
60db5b5a1b win,build: remove unused build defines
PR-URL: https://github.com/libuv/libuv/pull/777
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-23 14:20:57 +01:00
Ben Noordhuis
b12624c136 unix: retry ioctl(TIOCGWINSZ) on EINTR
Some platforms (notably Solaris) can fail in this ioctl() if interrupted
by a signal.  Retry the system call when that happens.

Fixes: https://github.com/nodejs/node/issues/5737
PR-URL: https://github.com/libuv/libuv/pull/772
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-20 13:09:16 +01:00
Ben Noordhuis
df96163702 doc: clarify uv_loop_close()
Make explicit that handles and requests should be closed before calling
uv_loop_close().

Fixes: https://github.com/libuv/libuv/issues/765
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-20 10:15:20 +01:00
cjihrig
f04d5fc3b9 win: use native APIs for UTF conversions
This commit replaces uv_utf16_to_utf8() and uv_utf8_to_utf16()
with calls to the native Windows API equivalents.

Refs: https://github.com/libuv/libuv/pull/672#discussion_r49049746
PR-URL: https://github.com/libuv/libuv/pull/762
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-18 12:40:57 -04:00
Yuval Brik
5dc15cc269 fs: realpath: fix string size before converting
fs__realpath_handle() removes the UNC prefixes \\?\ and \\?\UNC\
from paths returned by GetFinalPathNameByHandle, but doesn't
update the string length before sending it to fs__wide_to_utf8.
Fix that by decrement the correct size from the string length.

PR-URL: https://github.com/libuv/libuv/pull/733
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-18 12:30:12 +01:00
Santiago Gimeno
c7c8e916b8 poll: add UV_DISCONNECT event
It allows detecting the remote socket closing the connection. It's
emitted when `EPOLLRDHUP`(Linux), `EV_EOF`(BSD), `POLLRDHUP`(Solaris,
AIX) and `AFD_POLL_DISCONNECT`(Windows) events are received.

PR-URL: https://github.com/libuv/libuv/pull/691
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-15 23:39:49 +01:00