chroot stub, getpass advice

Theo Markettos theo at markettos.org.uk
Wed Mar 6 10:55:29 PST 2002


Here's a basic stub for chroot.  This is my first patch, so I'm not sure
what to do about creating a new file (I assume CVS sorts all the rcs
tags), and please tell me if there's a better diff format...

Also, I'm looking at implementing getpass.  But tty.c is big and scary,
and I don't understand how to turn echo off.  Essentially I want to do:

echo(off);
fgets(pass,length,stdin);
echo(on);

but there's probably a better way to do that.  Any advice?

Cheers,
Theo

Index: unixlib/source/Makefile
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/Makefile,v
retrieving revision 1.4.2.9
diff -u -r1.4.2.9 Makefile
--- unixlib/source/Makefile	2001/12/19 16:52:15	1.4.2.9
+++ unixlib/source/Makefile	2002/03/06 18:45:24
@@ -474,6 +474,7 @@
 	$(libunixobj)/unix/chdir.o \
 	$(libunixobj)/unix/chmod.o \
 	$(libunixobj)/unix/chown.o \
+	$(libunixobj)/unix/chroot.o \
 	$(libunixobj)/unix/close.o \
 	$(libunixobj)/unix/creat.o \
 	$(libunixobj)/unix/getdtables.o \

and chroot.c is:
/****************************************************************************
 *
 * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/unix/chroot.c,v $
 * $Date: 2002/01/31 14:32:04 $
 * $Revision: 1.2.2.1 $
 * $State: Exp $
 * $Author: admin $
 *
 ***************************************************************************/

#ifdef EMBED_RCSID
static const char rcs_id[] = "$Id: chroot.c,v 1.2.2.1 2002/01/31 14:32:04 admin Exp $";
#endif

#include <errno.h>
#include <unistd.h>

int
chroot (const char *path)
{
  path = path;

  return __set_errno (ENOSYS);
}




-- 
Theo Markettos                 theo at markettos.org.uk
Gonville and Caius College     theom at chiark.greenend.org.uk
Cambridge, CB2 1TA, UK         http://www.markettos.org.uk/




More information about the gcc mailing list