杨光辉 wrote:
> /*pwd.c on the coreutils-6.9*/
>          static void
>          robust_getcwd (struct file_name *file_name)
>         {
>           size_t height = 1;
> 262    struct dev_ino dev_ino_buf;
> 263    struct dev_ino *root_dev_ino = get_root_dev_ino (&dev_ino_buf);
> 
>           .......
>         }
> The line 262 and 263 have something wrong. "dev_ino_buf " didn't allocate
> memory. I compilered the pwd.c and found some buggers. Maybe I'm wrong.

The dev_ino_buf variable is a local variable.  The compiler will
reserve space for it on the stack.  In C this is an "automatic"
variable.

The get_root_dev_ino() routine returns the &dev_ino_buf parameter
value as the return value of the function and it is assigned to the
root_dev_ino variable.

This is not "memory allocation" in the malloc() sense of memory
allocation.  All of the variables are local variables and the C
compiler will reserve local stack space for them.  What do you mean
when you say "didn't allocate memory" for them?

Are you having a problem with the coreutils pwd?

Bob


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to