
system call in Sun OS - need help
Quote:
>#include <stdio.h>
>#include <string.h>
>main()
>{
>int chroot();
>char dir[80];
> strcpy(dir,"new/directory");
> chroot(dir);
>}
>Is there something I am not doing in order to make a system call? I would
>appreciate any help you can provide. Thanks in advance.
1. How do you know it fails? You're not checking its return value and
the program terminates before doing anything meaningful.
2. Are you root when executing the program?
3. Checking errno if chroot() doesn't return 0 will give you a clue about
what went wrong.
4. If you expect the program to change the root directory of the shell
which invoked it, this will never happen, chroot() will affect only
the process that called it.
This is a Unix specific question, so it doesn't belong to c.l.c. Post
such questions to comp.unix.programmer.
Dan
--
Dan Pop
CERN, CN Division
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland