aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/stat_2.f90
blob: 3c4b2529ce74c69f22996ffa2e5040a7b5eaae99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { dg-do run }
! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
! { dg-options "-std=gnu" }
  character(len=*), parameter :: f = "testfile"
  integer :: s1(13), r1, s2(13), r2, s3(13), r3
  
  open (10,file=f)
  write (10,"(A)") "foo"
  close (10,status="keep")

  open (10,file=f)
  r1 = lstat (f, s1)
  r2 = stat (f, s2)
  r3 = fstat (10, s3)

  if (r1 /= 0 .or. r2 /= 0 .or. r3 /= 0) call abort
  if (any (s1 /= s2) .or. any (s1 /= s3)) call abort
  if (s1(5) /= getuid()) call abort
  if (s1(6) /= getgid() .and. getgid() /= 0) call abort
  if (s1(8) < 3 .or. s1(8) > 5) call abort

  close (10,status="delete")
  end