joyent/node — pull request #2050 by shigeki (2011-11-08 16:09:32+00:00)
Title: Fix to throw an ENOSYS error properly at fs.futimesSync() when futimes(3) is not supported.

When futimes(3) is not supported, Node was crashed by invoking fs.futimesSync() because the fs_req_wrap destructor calls free(req->path) without initializing. Here below is the reproduction code of crash.

var fs = require('fs');
var fd = fs.openSync(__filename, 'r');
fs.futimesSync(fd, new Date(), new Date());

Fix to throw an ENOSYS error properly when fs.futimesSync() is invoked and HAVE_FUTIMES is false by adding NULL initialization of req->path at the fs_req_wrap constructor.

It can also be fixed by another patch if we move uv_fs_req_init() out of #if HAVE_FUTIMES at deps/uv/src/unix/fs.c:524 but this pull request has only the former.

I also found that the async call of fs.uv_fs_futime() causes the assertion error at the same case. Since it seems to have several options to fix, I will submit an another issue ticket.