On Fri, Sep 2, 2011 at 21:39, Paul Eggert <[email protected]> wrote:

> On 09/02/11 15:39, Kevin Brott wrote:
>
> > $ echo xxxx > file1
> > $ TAR_OPTIONS=--numeric-owner truss src/tar chof archive file1
> > ...
> > fstatat (-2, "file1", 2ff22688, 0) -> -1; errno = 22 (A system call
> received a parameter that is not valid.)
> > ...
> > $ src/tar cf archive file1
> > fstatat (-2, "file1", 2ff226a8, 1) -> 0; st_size = 5
>
> That's interesting.  It appears that fstatat (AT_FDCWD, ...)  works
> only if the last argument is 1.  Can you reproduce the problem with
> the following little test program?
>
>  #include <fcntl.h>
>  #include <sys/stat.h>
>
>  int
>  main (void)
>  {
>    struct stat a;
>     if (fstatat (AT_FDCWD, ".", &a, 0) != 0)
>      return 1;
>    return 0;
>  }
>
> If my guess is right, this returns nonzero exit status, which is a bug.
>
> If my guess is wrong, perhaps you can change the test to make it
> "right", by replacing "." with the name of some other file in the
> working directory, or by compiling with -D_LARGE_FILES, or by doing
> both at the same time.
>
>
*$ xlc -o test test.c
$ ./test ; echo $?
1

$ vi test;c ; cat test.c
 #include <fcntl.h>
 #include <sys/stat.h>

 int
 main (void)
 {
   struct stat a;
   if (fstatat (AT_FDCWD, "config.log", &a, 0) != 0)
     return 1;
   return 0;
 }

$ xlc -o test1 test.c
$ ./test1 ; echo $?
1

$ xlc -D_LARGE_FILES -o test2 test.c
$ ./test2 ; echo $?
1

$ vi test.c ; cat test.c
 #include <fcntl.h>
 #include <sys/stat.h>

 int
 main (void)
 {
   struct stat a;
   if (fstatat (AT_FDCWD, "config.log", &a, 1) != 0)
     return 1;
   return 0;
 }

$ xlc -o test3 test.c
$ ./test3 ; echo $?
0

*Looks like you're right.

-- 
# include <stddisclaimer.h>
/* Kevin  Brott <[email protected]> */

Reply via email to