This appendix gives the full source code to jbchroot.c, which we
introduced and detailed in Chapter 6. This program is a Linux and
Solaris port of the OpenBSD
chroot command. The code
remains released under the included open source BSD license, and is freely distributable.
Also, you can download Appendix B from this book's web site at http://www.oreilly.com/catalog/9780596101060.
Example B-1. jbchroot.c
/* $OpenBSD: chroot.c,v 1.7 2002/10/29 23:12:06 millert Exp $ */ /* $NetBSD: chroot.c,v 1.11 2001/04/06 02:34:04 lukem Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived ...