@@ -246,12 +246,12 @@ test_io_read_write(void)
246
246
test_errno ("open" , errno , 0 );
247
247
test_stop ();
248
248
}
249
- struct stat sb ;
250
- if (fstat (in , & sb )) {
251
- test_errno ("fstat" , errno , 0 );
252
- test_stop ();
253
- }
254
- const size_t siz_in = MIN (1024 * 1024 , sb .st_size );
249
+ struct stat sb ;
250
+ if (fstat (in , & sb )) {
251
+ test_errno ("fstat" , errno , 0 );
252
+ test_stop ();
253
+ }
254
+ const size_t siz_in = MIN (1024 * 1024 , sb .st_size );
255
255
256
256
int out = mkstemp (path_out );
257
257
if (out == -1 ) {
@@ -351,11 +351,11 @@ test_async_read(char *path, size_t size, int option, dispatch_queue_t queue,
351
351
{
352
352
int fd = open (path , O_RDONLY );
353
353
if (fd == -1 ) {
354
- // Don't stop for access permission issues
355
- if (errno == EACCES ) {
356
- process_data (size );
357
- return ;
358
- }
354
+ // Don't stop for access permission issues
355
+ if (errno == EACCES ) {
356
+ process_data (size );
357
+ return ;
358
+ }
359
359
test_errno ("Failed to open file" , errno , 0 );
360
360
test_stop ();
361
361
}
@@ -575,18 +575,18 @@ test_io_from_io(void) // rdar://problem/8388909
575
575
test_ptr_notnull ("mkdtemp failed" , path );
576
576
test_stop ();
577
577
}
578
- #ifdef __APPLE__
578
+ #ifdef UF_IMMUTABLE
579
579
// Make the directory immutable
580
580
if (chflags (path , UF_IMMUTABLE ) == -1 ) {
581
581
test_errno ("chflags" , errno , 0 );
582
582
test_stop ();
583
583
}
584
584
#else
585
585
// Make the directory non-read/writeable
586
- if (chmod (path , 0 ) == -1 ) {
587
- test_errno ("chmod" , errno , 0 );
588
- test_stop ();
589
- }
586
+ if (chmod (path , 0 ) == -1 ) {
587
+ test_errno ("chmod" , errno , 0 );
588
+ test_stop ();
589
+ }
590
590
#endif
591
591
* tmp = '/' ;
592
592
dispatch_io_t io = dispatch_io_create_with_path (DISPATCH_IO_RANDOM , path ,
@@ -605,7 +605,7 @@ test_io_from_io(void) // rdar://problem/8388909
605
605
dispatch_group_enter (g );
606
606
dispatch_io_write (io , 0 , tdata , q , ^(bool done , dispatch_data_t data_out ,
607
607
int err_out ) {
608
- #ifdef __APPLE__
608
+ #ifdef UF_IMMUTABLE
609
609
test_errno ("error from write to immutable directory" , err_out , EPERM );
610
610
#else
611
611
test_errno ("error from write to write protected directory" , err_out , EACCES );
@@ -622,18 +622,18 @@ test_io_from_io(void) // rdar://problem/8388909
622
622
dispatch_release (io );
623
623
test_group_wait (g );
624
624
* tmp = '\0' ;
625
- #ifdef __APPLE__
626
- // Change the directory to mutable
627
- if (chflags (path , 0 ) == -1 ) {
628
- test_errno ("chflags" , errno , 0 );
629
- test_stop ();
630
- }
625
+ #ifdef UF_IMMUTABLE
626
+ // Change the directory to mutable
627
+ if (chflags (path , 0 ) == -1 ) {
628
+ test_errno ("chflags" , errno , 0 );
629
+ test_stop ();
630
+ }
631
631
#else
632
- // Change the directory to user read/write/execute
633
- if (chmod (path , S_IRUSR | S_IWUSR | S_IXUSR ) == -1 ) {
634
- test_errno ("chmod" , errno , 0 );
635
- test_stop ();
636
- }
632
+ // Change the directory to user read/write/execute
633
+ if (chmod (path , S_IRUSR | S_IWUSR | S_IXUSR ) == -1 ) {
634
+ test_errno ("chmod" , errno , 0 );
635
+ test_stop ();
636
+ }
637
637
#endif
638
638
const char * path_in = "/dev/urandom" ;
639
639
int in = open (path_in , O_RDONLY );
0 commit comments