Method: Dir.chroot

Defined in:
dir.c

.chroot(string) ⇒ 0

Changes this process’s idea of the file system root. Only a privileged process may make this call. Not available on all platforms. On Unix systems, see chroot(2) for more information.

Returns:

  • (0)


1210
1211
1212
1213
1214
1215
1216
1217
1218
# File 'dir.c', line 1210

static VALUE
dir_s_chroot(VALUE dir, VALUE path)
{
    path = check_dirname(path);
    if (chroot(RSTRING_PTR(path)) == -1)
	rb_sys_fail_path(path);

    return INT2FIX(0);
}