Changeset 3783:9d56be5fbe0f in roaraudio for libroaross


Ignore:
Timestamp:
05/07/10 13:35:02 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

allow access() on internal files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaross/libroaross.c

    r3782 r3783  
    16771677 
    16781678int access(const char *pathname, int mode) { 
     1679 struct devices * ptr = NULL; 
     1680 int i; 
    16791681 
    16801682 _init(); 
     1683 
     1684 for (i = 0; _device_list[i].prefix != NULL; i++) { 
     1685  if ( !strcmp(pathname, _device_list[i].prefix) ) { 
     1686   ptr = &(_device_list[i]); 
     1687  } 
     1688 } 
     1689 
     1690 if ( ptr != NULL ) { 
     1691  // the only flag we do not support is +x, which means 
     1692  // we need to reject all requets with X_OK. 
     1693  if ( mode & X_OK ) { 
     1694   errno = EACCES; 
     1695   return -1; 
     1696  } 
     1697 
     1698  // in addition HT_STATIC files do not support write (+w) 
     1699  // so we need to reject W_OK. 
     1700  if ( ptr->type == HT_STATIC && (mode & W_OK) ) { 
     1701   errno = EACCES; 
     1702   return -1; 
     1703  } 
     1704 
     1705  // Else the access is granted: 
     1706  return 0; 
     1707 } 
    16811708 
    16821709 return _os.access(pathname, mode); 
Note: See TracChangeset for help on using the changeset viewer.