test: fix fs_chown when running as root
chown(2) to root is expected to fail - unless you're root, of course.
This is a backport of d0be852 (v1.x)
PR-URL: https://github.com/libuv/libuv/pull/441
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
8f931a229a
commit
8af26a7b84
@ -196,9 +196,16 @@ static void chown_root_cb(uv_fs_t* req) {
|
||||
/* On windows, chown is a no-op and always succeeds. */
|
||||
ASSERT(req->result == 0);
|
||||
#else
|
||||
/* On unix, chown'ing the root directory is not allowed. */
|
||||
ASSERT(req->result == -1);
|
||||
ASSERT(req->errorno == UV_EPERM);
|
||||
/* On unix, chown'ing the root directory is not allowed -
|
||||
* unless you're root, of course.
|
||||
*/
|
||||
if (geteuid() == 0) {
|
||||
ASSERT(req->result == 0);
|
||||
}
|
||||
else {
|
||||
ASSERT(req->result == -1);
|
||||
ASSERT(req->errorno == UV_EPERM);
|
||||
}
|
||||
#endif
|
||||
chown_cb_count++;
|
||||
uv_fs_req_cleanup(req);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user