source: rtems/c/src/tests/psxtests/psxstat/test.c @ f2278a8

4.104.114.84.95
Last change on this file since f2278a8 was f2278a8, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 7, 2001 at 11:57:59 PM

2001-11-07 Jennifer Averett <jennifer@…>

Reported by Ibragimov Ilya <ibr@…> and tracked as PR63.

  • psxstat/test.c: Fix test ENOTDIR to correspond to chdir() change. Since we check permissions before evaluating enough to see if it a regular file or directory, this hack is needed to make the regular file executable.
  • Property mode set to 100644
File size: 19.1 KB
Line 
1/*
2 *  This test exercises stat() via fstat() and generates as many of the
3 *  path evaluation cases as possible.
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <tmacros.h>
16#include <assert.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <limits.h>
20#include <stdio.h>
21#include <unistd.h>
22#include <errno.h>
23#include <string.h>
24#include <rtems.h>
25#include <rtems/libio.h>
26#include <imfs.h>
27
28#define MAXSYMLINK 5   /* There needs to be a better way of getting this. */
29#define TIMEOUT_VALUE  ( 5 * TICKS_PER_SECOND )
30
31
32/*
33 *  List of files which should exist.
34 */
35
36char *Files[] = {
37  "/////my_mount_point/dir1/\\//file1\\\\//",
38  "/my_mount_point/dir1/file2",
39  "/my_mount_point/dir1/file3",
40  "/my_mount_point/dir1/file4",
41  "/my_mount_point/dir1/dir1/file1",
42  "../../..//my_mount_point/dir1/./././dir1/ file1",
43  "main.c",
44  0
45};
46
47/*
48 *  List of directories which should exist.
49 */
50
51char *Directories[] = {
52  "/my_mount_point/dir1",
53  "/my_mount_point/dir2",
54  "/my_mount_point/dir3",
55  "/my_mount_point/dir4",
56  "/my_mount_point/dir1/dir1",
57  "/./././my_mount_point/dir1/ dir1",
58  "/./././my_mount_point/links", 
59  "///my_mount_point/dir1/dir1/../../dir1/../symlinks/////",
60  0
61};
62
63char *Links_to_Dirs[]= {
64  "dir1/dir1/../../links/dir1",
65  "links/dir2",
66  "links/dir3",
67  "links/dir4",
68  "links/dir1_dir1",
69  "links/dir1_ dir1",
70  "links/../links/../links/links",
71  0
72};
73
74char *Links_to_Files[]= {
75  "links/dir1_file1",
76  "links/dir1_file2",
77  "links/dir1_file3",
78  "links/dir1_file4",
79  "links/dir1_dir1_f1",
80  "links/dir1_dir1 f1",
81  0
82};
83
84char *Links_to_dirlinks[]= {
85  "links/links/links/links_dir1",
86  "links//links_dir2",
87  "links//links_dir3",
88  "links//links_dir4",
89  "links//links_dir1_d1",
90  "links//links_dir1 d1",
91  "links//links_links",
92  0
93};
94
95char *Links_to_filelinks[]= {
96  "links///links_d1_file1",
97  "links///links_d1_file2",
98  "links///links_d1_file3",
99  "links///links_d1_file4",
100  "links///links_d1_d1_f1",
101  "links///links_r1_d1 f1",
102  0
103};
104
105char *SymLinks[]= {
106  "/my_mount_point/symlinks/a_file_symlink",
107  "/my_mount_point/symlinks/a_dir_symlink",
108  "/my_mount_point/symlinks/a_link_symlink",
109  "../symlinks/no_file",
110  "/my_mount_point/symlinks/a_dir_symlink/a_file_symlink",
111  0
112};
113
114/*
115 *  List of absolute paths to stat.
116 */
117
118char *Good_absolute_paths[] = {
119  "/my_mount_point/dev",
120  "////my_mount_point/dir1/\\//file1\\\\//",
121  "/my_mount_point/dir1/\\\\/file2",
122  "/my_mount_point/dir1/file3/////\\\\\\",
123  "/my_mount_point/dir1/file4",
124  "/my_mount_point/dir1/dir1/file1",
125  "/my_mount_point/dir1/dir1/ file1",
126  "/my_mount_point/dir1",
127  "/my_mount_point/dir2//////\\",
128  "/my_mount_point/dir3",
129  "/my_mount_point/dir4",
130  "/my_mount_point/dir1/dir1",
131  "/my_mount_point/dir1/ dir1///\\\\",
132  "/my_mount_point/\\/\\/\\/\\/\\/\\/links\\/\\/\\/\\/\\/\\",
133  0
134};
135
136
137char *Bad_paths[] = {
138  "/my_mount_point/links/ENAMETOOLONG__________________________",
139  "/my_mount_point/dir1/file4/NOTADIR",
140  "/my_mount_point/dir1/dir1/EACCES__",
141  0
142};
143
144/*
145 *  List of relative paths to stat.
146 */
147
148char *Good_relative_paths[] = {
149  "dev",
150  "dir1/\\//file1\\\\//",
151  "dir1/\\\\/file2",
152  "dir1/file3/////\\\\\\",
153  "dir1/file4",
154  "dir1/dir1/file1",
155  "dir1/dir1/ file1",
156  "dir1",
157  "dir2//////\\",
158  "dir3",
159  "dir4",
160  "dir1/dir1",
161  "dir1/ dir1///\\\\",
162  "main.c",
163  0
164};
165
166/*
167 *  Do a stat on a single file and report the status.
168 */
169
170void stat_a_file(
171  const char *file
172)
173{
174  int         status;
175  struct stat statbuf;
176  int         major1;
177  int         minor1;
178  int         major2;
179  int         minor2;
180
181
182  assert( file );
183
184  printf( "stat( %s ) returned ", file );
185  fflush( stdout );
186
187  status = stat( file, &statbuf );
188
189  if ( status == -1 ) {
190    printf( ": %s\n", strerror( errno ) );
191  } else {
192
193    rtems_filesystem_split_dev_t( statbuf.st_dev, major1, minor1 );
194    rtems_filesystem_split_dev_t( statbuf.st_rdev, major2, minor2 );
195
196
197    printf("\n...st_dev     (0x%x:0x%x)\n", major1, minor1 );
198    printf(  "...st_ino     %x\n", (int) statbuf.st_ino );
199    printf(  "...st_mode    %o\n", statbuf.st_mode );
200    printf(  "...st_nlink   %x\n", statbuf.st_nlink );
201    printf(  "...st_uid     %d\n", statbuf.st_uid );
202    printf(  "...st_gid     %d\n", statbuf.st_gid );
203    printf(  "...st_rdev    (0x%x:0x%x)\n", major2, minor2 );
204    printf(  "...st_size    %d\n",(unsigned int) statbuf.st_size );
205    printf(  "...st_atime   %s", ctime( &statbuf.st_atime ) );
206    printf(  "...st_mtime   %s", ctime( &statbuf.st_mtime ) );
207    printf(  "...st_ctime   %s", ctime( &statbuf.st_ctime ) );
208#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
209    printf(  "...st_blksize %x\n", statbuf.st_blksize );
210    printf(  "...st_blocks  %x\n", statbuf.st_blocks );
211#endif
212
213  }
214}
215
216/*
217 *  stat() multiple files at a time
218 */
219
220void stat_multiple_files(
221  char **files
222)
223{
224  int    i;
225
226  i = 0;
227  while ( files[i] ) {
228    stat_a_file( files[i] );
229    i++;
230  }
231}
232
233/*
234 *  chown() multiple files at a time
235 */
236void chown_multiple_files(
237  char **files
238)
239{
240  int    i;
241  uid_t  st_uid;
242  gid_t  st_gid;
243
244  st_uid = geteuid();
245  st_gid = getegid();
246
247  i = 0;
248  while ( files[i] ) {
249    printf("Change group of %s\n", files[i]);
250    chown( files[i], st_uid, (st_gid+1) );
251    stat_a_file( files[i] );
252
253    printf("Change owner of %s\n", files[i]);
254    chown( files[i], (st_uid+1), st_gid );
255    stat_a_file( files[i] );
256    i++;
257  }
258
259}
260
261
262
263/*
264 *  mknod() multiple files at a time
265 */
266
267void make_multiple_files(
268  char **files
269)
270{
271  int    i;
272  int    status;
273
274  i = 0;
275  while ( files[i] ) {
276    printf( "Making file %s\n", files[i] );
277    status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
278    assert( !status );
279    i++;
280  }
281  puts( "" );
282}
283
284void make_multiple_bad_files(
285  char **files
286)
287{
288  int    i;
289  int    status;
290
291  i = 0;
292  while ( files[i] ) {
293    printf( "Making file %s ", files[i] );
294    status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
295    assert( status );
296    printf( ": %s\n", strerror( errno ) );
297    i++;
298  }
299  puts( "" );
300}
301
302void make_multiple_links(
303  char **existing,
304  char **new
305)
306{
307  int    i;
308  int    status;
309
310  i = 0;
311  while ( new[i] && existing[i] ) {
312    printf( "Making file %s\n", new[i] );
313    status = link( existing[i], new[i] );
314    assert( !status );
315    i++;
316  }
317  puts( "" );
318
319  status = link( "fred", "bob" );
320  assert( status == -1 );
321
322  status = link( existing[1], "doug/bob" );
323  assert( status == -1 );
324}
325
326
327void make_too_many_links()
328{
329  int    i;
330  int    status;
331  char   name [20];
332
333  status = mkdir("/dummy", S_IRWXU );
334  assert( status == 0 );
335
336  for (i=1; i<= LINK_MAX; i++) {
337
338    sprintf(name,"/LinkName%d",i);
339    printf( "Making file %s\n", name );
340    status = link("/dummy" , name );
341    if( i < LINK_MAX )
342       assert( !status );
343    else
344       assert( status == -1 );
345
346  }
347}
348
349
350void make_a_symlink(
351  char *existing,
352  char *new
353)
354{
355  int    status;
356  char   buf[100];
357  int    len;
358
359  memset( buf, 0, 100 );
360
361  printf( "Making file %s\n", new );
362  status = symlink( existing, new );
363  assert( !status );
364
365  printf( "Verify with readlink\n");
366  status = readlink( new, buf, 100 );
367  len = strlen( existing );
368  assert ( status == len );
369
370  status = readlink( new, buf, 3 );
371  len = strlen( existing );
372  if (len < 3 )
373    assert( status == len );
374  else
375    assert( status == 3 );
376
377  status = strcmp( existing, buf );
378  assert( !status );
379}
380
381void make_multiple_symlinks()
382{
383 int  status;
384
385 make_a_symlink( Files[0],             SymLinks[0] );
386 make_a_symlink( Directories[0],       SymLinks[1] );
387 make_a_symlink( Links_to_dirlinks[0], SymLinks[2] );
388 make_a_symlink( "No_File",            SymLinks[3] );
389 make_a_symlink( SymLinks[1],          SymLinks[4] );
390 make_a_symlink( "//my_mount_point/links","/my_mount_point/symlinks/links" );
391
392 stat_a_file( SymLinks[0] );
393 stat_a_file( SymLinks[1] );
394 stat_a_file( SymLinks[2] );
395 stat_a_file( SymLinks[3] );
396 stat_a_file( SymLinks[4] );
397
398 status = symlink(  "//links", "bob/frank" );
399 assert (status == -1);
400
401}
402/*
403void make_too_many_symlinks()
404{
405  int  i, status;
406  char name1[8];
407
408  for (i=1; i <= MAXSYMLINK; i++) {
409    sprintf( name1, "SymLink%d", i );
410    status = symlink( "/dummy", name1 );
411    if( i < MAXSYMLINK )
412       assert( !status );
413    else
414       assert( status == -1 );
415  }
416}
417*/
418void make_many_symlinks(
419  char  *real_file,
420  int    link_count
421)
422{
423  int  i;
424  char name1[5];
425  char name2[5];
426  char *link_file;
427
428  link_file = real_file;
429  for (i=1; i < link_count; i++) {
430    sprintf( name1, "%d", i );
431    make_a_symlink( link_file, name1 );
432    strcpy( name2, name1 );
433    link_file = name2;
434  }
435
436  for (i=1; i < link_count; i++) {
437    sprintf( name1, "%d", i );
438    stat_a_file( name1 );
439  }
440
441}
442
443/*
444 *  mkdir() multiple directories at a time
445 */
446 
447void make_multiple_directories(
448  char **files
449) 
450{
451  int    i;
452  int    status;
453
454  i = 0; 
455  while ( files[i] ) {
456    printf( "Making directory %s\n", files[i] );
457    status = mkdir( files[i], S_IRWXU );
458    assert( !status );
459    i++;
460  }
461  puts( "" );
462} 
463
464/*
465 * Cause faults.
466 */
467
468
469void Cause_faults()
470{
471  int                                   fd;
472  int                                   status;
473  char                                  longer_name[100];
474  rtems_filesystem_mount_table_entry_t *mt_entry;
475
476  /*
477   * Verify chmod with an invalid type.
478   */
479
480  printf("\n\nPass an invalid mode to chmod should fail with EPERM \n" );
481  status = chmod( Files[0], S_IFREG );
482  assert( status == -1 ); 
483  assert( errno == EPERM );
484
485  /*
486   * Change file to executable then try to chdir to it.
487   */
488
489  status = chmod( Files[0], S_IXUSR );
490  assert( status != -1 );
491
492  printf("chdir to a file should fail with ENOTDIR\n");
493  status = chdir( Files[0] );
494  assert( status == -1 );
495  assert( errno == ENOTDIR );
496
497  /*
498   * Change mode to read/write on a directory.
499   * Verify directory works properly.
500   */
501
502  printf("Verify RWX permission on %s via access\n", Directories[0]);
503  status = access( Directories[0], ( R_OK | W_OK | X_OK )  );
504  assert( status == 0 );
505
506  printf( "chmod of %s to Read/Write\n", Directories[0] );
507  status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
508  assert( status == 0 );
509
510  printf( "chmod fred should fail with ENOENT\n" );
511  status = chmod( "fred", (S_IXGRP | S_IXOTH) );
512  assert( status == -1 );
513  assert( errno == ENOENT );
514
515  strcpy(longer_name, Directories[0] );
516  strcat(longer_name, "/BADNAME" );
517  printf( "Create under %s should fail with EACCES\n", Directories[0] );
518  status = mkdir( longer_name , S_IRWXU );
519  assert( status == -1 );
520  assert( errno == EACCES );
521
522  printf("chdir to %s should fail with EACCES\n", Directories[4] );
523  status = chdir( Directories[4] );
524  assert( status == -1 );
525  assert( errno == EACCES );
526
527  /*
528   * Check stat with a NULL buffer.
529   */
530
531  printf("Stat with a NULL buffer should fail with EFAULT\n");
532  status = stat( Directories[0], NULL );
533  assert( status == -1 );
534  assert( errno == EFAULT );
535
536  /*
537   * Set current to a directory with no owner permissions.
538   * Verify it works properly.
539   */
540
541  printf( "\n\nchmod of %s to Read/Write\n", Directories[0] );
542  status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
543  assert( status == 0 );
544
545  printf("mkdir %s should fail with EACCESS\n", longer_name );
546  status = mkdir( longer_name , S_IRWXU );
547  assert( status == -1 );
548  assert( errno == EACCES );
549
550  printf("\n%s Should exist ( access )\n",Directories[0] );
551  status = access( Directories[0], F_OK );
552  assert( status == 0 );
553  printf("\n%s Should have read  permission( access )\n",Directories[0] );
554  status = access( Directories[0], R_OK );
555  assert( status != 0 );
556  printf("\n%s Should have write permission( access )\n",Directories[0] );
557  status = access( Directories[0], W_OK );
558  assert( status != 0 );
559  printf("\n%s Should not have execute permission( access )\n",Directories[0] );
560  status = access( Directories[0], X_OK );
561  assert( status != 0 );
562 
563  printf("\nRestore %s to RWX\n",Directories[0] );
564  status = chmod( Directories[0], S_IRWXU );
565  assert( status == 0 );
566
567  printf("chdir to /my_mount_point \n");
568  status = chdir( "/my_mount_point" );
569  assert( status == 0 );
570
571  /*
572   * Remove one of the directories.
573   * Verify links to the removed directory still work.
574   */
575
576  printf( "Remove %s\n", Directories[5] );
577  status = rmdir( Directories[5] );
578  assert( status == 0 );
579
580  stat_a_file( Directories[5] );
581  status = access( Directories[5], F_OK );
582  assert( status != 0 );
583
584  stat_a_file( Links_to_Dirs[5] );
585  status = readlink( Links_to_Dirs[5], longer_name, 3 );
586  assert( status == -1 );
587  assert( errno == EINVAL );
588
589  stat_a_file( Links_to_dirlinks[5] );
590  printf("Chdir to %s\n", Links_to_Dirs[5] );
591  status = chdir( Links_to_Dirs[5] );
592  assert( status == 0 );
593
594  /*
595   * Verify we cannot move up from a node with no parent node.
596   */
597
598  printf("Chdir to .. should fail with ENOENT\n" );
599  status = chdir( ".." );
600  assert( status == -1 );
601  assert( errno == ENOENT );
602
603  /*
604   * Create a subdirectory under the dangling node.
605   */
606
607  printf("mkdir ../t should fail with ENOENT\n" );
608  status = mkdir( "../t" , S_IRWXU );
609  assert( status == -1 );
610  assert( errno == ENOENT );
611
612  printf("mkdir t\n");
613  status = mkdir( "t" , S_IRWXU );
614  assert( status == 0 );
615
616  printf("chdir to /my_mount_point\n");
617  status = chdir( "/my_mount_point" );
618  assert( status == 0 );
619
620  /*
621   * Check rmdir, rmnod, and unlink
622   */
623
624  printf("rmdir %s should fail with ENOTDIR\n", Links_to_Dirs[5] );
625  status = rmdir( Links_to_Dirs[5] );
626  assert( status == -1 );
627  assert( errno == ENOTDIR );
628
629  printf("unlink %s\n", Links_to_Dirs[5] );
630  status = unlink( Links_to_Dirs[5] );
631  assert( status == 0 );
632
633  printf("unlink %s should fail with ENOTEMPTY\n", Links_to_dirlinks[5] );
634  status = unlink(  Links_to_dirlinks[5] );
635  assert( status == -1 );
636  assert( errno == ENOTEMPTY );
637
638  strcpy( longer_name,  Links_to_dirlinks[5] );
639  strcat( longer_name, "/t");
640  printf("rmdir %s\n", longer_name );
641  status = rmdir( longer_name );
642  assert( status == 0 );
643
644  printf("unlink %s\n", Links_to_Dirs[5]);
645  status = unlink( Links_to_dirlinks[5] );
646  assert( status == 0 );
647
648  status = chdir( Directories[0] );
649  status = mkdir ( "my_mount_point", S_IRWXU );
650  assert( status == 0 );
651
652  printf("Attempting to mount IMFS file system at /dir1/my_mount_point \n");
653  status = mount(
654     &mt_entry,
655     &IMFS_ops,
656     RTEMS_FILESYSTEM_READ_WRITE,
657     NULL,
658     "/my_mount_point/dir1/my_mount_point" );
659  assert( status == 0 );
660
661  printf("rmdir /dir1/my_mount_point should fail with EBUSY\n");
662  status = rmdir ("/my_mount_point/dir1/my_mount_point" );
663  assert( status == -1 );
664  assert( errno == EBUSY );
665
666  printf( "Unmount /my_mount_point/dir1/my_mount_point\n");
667  status = unmount( "/my_mount_point/dir1/my_mount_point" );
668  assert( status == 0 );
669
670  /*
671   * Verify write permission is checked.
672   */
673
674  printf("chmod of %s to group and other execute\n", Files[0] );
675  status = chmod (Files[0], (S_IXGRP | S_IXOTH) );
676  assert( status == 0 );
677
678  printf("Open %s for write should fail with EACCES\n", Files[0] );
679  fd = open (Files[0], O_WRONLY); 
680  assert( fd == -1 );
681  assert( errno == EACCES );
682
683  printf("chmod of %s to User Execute and Read\n", Directories[3] );
684  status = chmod (Directories[3], (S_IXUSR | S_IRUSR) );
685  assert( status == 0 );
686  strcpy(longer_name, Directories[3] );
687  strcat(longer_name, "/NewFile" );
688  printf("Mkdir of %s should fail with EACCES\n",longer_name );
689  status = mkdir( longer_name, S_IRWXU );
690  assert( status != 0 );
691  assert( errno == EACCES );
692
693  printf("Making too many hard links.\n" );
694  make_too_many_links( );
695
696  printf( "pass fstat a null pointer should fail with EFAULT\n");
697  status = fstat( fd, NULL );
698  assert( status == -1 ); 
699  assert( errno == EFAULT);
700
701  /*
702   * The current directory MUST be restored at the end of this test.
703   */
704
705  printf("chdir to /my_mount_point \n");
706  status = chdir( "/my_mount_point" );
707  assert( status == 0 );
708
709}
710
711void Show_Time()
712{
713  rtems_time_of_day time;
714  rtems_status_code status;
715
716  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
717  printf(">>>>Current Time: ");
718  print_time( " - rtems_clock_get - ", &time, "\n" );
719}
720
721/*
722 *  main entry point to the test
723 */
724
725#if defined(__rtems__)
726int test_main(void)
727#else
728int main(
729  int    argc,
730  char **argv
731)
732#endif
733{
734  rtems_status_code                    status;
735  rtems_time_of_day                    time;
736  rtems_filesystem_mount_table_entry_t *mt_entry;
737
738  puts( "\n\n*** STAT TEST 01 ***" );
739
740  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
741  status = rtems_clock_set( &time );
742  Show_Time();
743
744  /*
745   * Create and mount another version of the filesyste.
746   * This allows expected node id's to be consistant across
747   * platforms and bsp's.
748   */
749
750  status = mkdir("/my_mount_point",  S_IRWXU );
751  assert( status == 0 );
752  status = mount(
753     &mt_entry,
754     &IMFS_ops,
755     RTEMS_FILESYSTEM_READ_WRITE,
756     NULL,
757     "my_mount_point" );
758  assert( status == 0 );
759  status = chdir( "/my_mount_point" );
760  assert( status == 0 );
761  status = mkdir("dev",  S_IRWXU );
762  assert( status == 0 );
763
764
765  /*
766   *  Create the files and directories for the test.
767   */
768
769  make_multiple_directories( Directories );
770  make_multiple_files( Files );
771  make_multiple_links( Directories,    Links_to_Dirs );
772  make_multiple_links( Files,          Links_to_Files );
773
774  status = rtems_task_wake_after( TIMEOUT_VALUE );
775  make_multiple_links( Links_to_Dirs,  Links_to_dirlinks );
776  status = rtems_task_wake_after( TIMEOUT_VALUE );
777  make_multiple_links( Links_to_Files, Links_to_filelinks );
778
779  status = rtems_task_wake_after( TIMEOUT_VALUE );
780
781  /*
782   *  Now go through all the absolute path.
783   */
784
785  puts( "Doing the stat() on all the good absolute paths" );
786  stat_multiple_files( Good_absolute_paths );
787
788  /*
789   *  run through the relative paths.
790   */
791
792  puts( "\nDoing the stat() on all the good relative paths" );
793  stat_multiple_files( Good_relative_paths );
794
795  /*
796   * Change directory and releative paths are now bad.
797   */
798
799  puts("\nchdir to dev");
800  chdir("dev");
801  puts("\nstat relative paths that are now bad");
802  stat_multiple_files( Good_relative_paths );
803
804  /*
805   * Change directory to the link directory and follow links.
806   */
807
808  puts("\nchdir to ../links");
809  chdir("../links");
810  puts("Doing the stat() on good links\n");
811  stat_multiple_files( Links_to_Dirs );
812  stat_multiple_files( Links_to_Files );
813  stat_multiple_files( Links_to_dirlinks  );
814  stat_multiple_files( Links_to_filelinks );
815 
816  /*
817   * Chmod on dir1/dir1.  This allows the error path to be hit.
818   */
819
820  printf( "chmod of %s to Read/Write\n", Directories[4] );
821  chmod( Directories[4], (S_IROTH|S_IWOTH) );
822  puts( "\nDoing the stat() on all the bad paths" );
823
824  stat_multiple_files( Bad_paths );
825  make_multiple_bad_files( Bad_paths );
826
827  printf( "Return %s to RWX\n", Directories[4] );
828  chmod( Directories[4], S_IRWXU );
829
830
831  /*
832   * Check out symbolic links.
833   */
834
835  make_multiple_symlinks();
836  make_many_symlinks( "/symlinks", 10 );
837
838  status = rtems_task_wake_after( TIMEOUT_VALUE );
839  Cause_faults();
840
841  status = rtems_task_wake_after( TIMEOUT_VALUE );
842  chown_multiple_files( Files );
843
844  status = rtems_task_wake_after( TIMEOUT_VALUE );
845  chown_multiple_files( Links_to_Dirs );
846 
847  puts( "\n\n*** END OF STAT TEST 01 ***" );
848  exit(0);
849}
850
851
852
853
854
855
856
Note: See TracBrowser for help on using the repository browser.