Re: chdir on linux does not work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi,

On Tue, May 23, 2006 at 07:49:29PM -0700, Noprianto wrote:
> -> from what i read, chdir is system call number 12

Yep, but better use something like

%define __NR_chdir               12

to make code more readable. Also, your example works just fine here:

$ nasm a.asm -f elf
$ gcc a.o -o a -nostdlib
$ strace ./a
execve("./a", ["./a"], [/* 30 vars */]) = 0
chdir("/bin")                           = 0
_exit(0)                                = ?

Remember that chdir affects only the process that calls chdir. You
can't e.g. write a replacement for shell's builtin "cd" command that
way.

best regards,
Timo Lindfors

Attachment: signature.asc
Description: Digital signature


[Kernel Newbies]     [Security]     [Linux C Programming]     [Linux for Hams]     [DCCP]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux