Changeset 78 for trunk/src/sh_unix.c


Ignore:
Timestamp:
Jan 9, 2007, 10:32:21 PM (18 years ago)
Author:
rainer
Message:

Fix for ticket #41 (unable to deactivate processcheck), and minor code cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_unix.c

    r76 r78  
    38333833/* Test whether file exists
    38343834 */
    3835 int sh_unix_file_stat(char * path)
     3835int sh_unix_file_exists(char * path)
    38363836{
    38373837  struct stat buf;
    38383838
    3839   SL_ENTER(_("sh_unix_file_stat"));
     3839  SL_ENTER(_("sh_unix_file_exists"));
    38403840
    38413841  if (-1 == retry_stat(FIL__, __LINE__, path, &buf))
    3842     SL_RETURN(  (0), _("sh_unix_file_stat"));
     3842    SL_RETURN( S_FALSE, _("sh_unix_file_exists"));
    38433843  else
    3844     SL_RETURN( (-1), _("sh_unix_file_stat"));
    3845 }
    3846 
    3847 
    3848 /* Test whether file exists, is a character device, allows read
    3849  * access, and is not world writeable.
     3844    SL_RETURN( S_TRUE,  _("sh_unix_file_exists"));
     3845}
     3846
     3847
     3848/* Test whether file exists, is a character device, and allows read
     3849 * access.
    38503850 */
    3851 int sh_unix_file_exists(int fd)
     3851int sh_unix_device_readable(int fd)
    38523852{
    38533853  struct stat buf;
    38543854
    3855   SL_ENTER(_("sh_unix_file_exists"));
     3855  SL_ENTER(_("sh_unix_device_readable"));
    38563856
    38573857  if (retry_fstat(FIL__, __LINE__, fd, &buf) == -1)
    3858     SL_RETURN( (-1), _("sh_unix_file_exists"));
    3859   else if ( S_ISCHR(buf.st_mode) &&  0 != (S_IROTH & buf.st_mode)
    3860             /*
    3861              * #if !defined(__CYGWIN32__) && !defined(__CYGWIN__)
    3862              * && 0 == (S_IWOTH & buf.st_mode)
    3863              * #endif
    3864              */
    3865             )
    3866     SL_RETURN( (0), _("sh_unix_file_exists"));
     3858    SL_RETURN( (-1), _("sh_unix_device_readable"));
     3859  else if ( S_ISCHR(buf.st_mode) &&  0 != (S_IROTH & buf.st_mode) )
     3860    SL_RETURN( (0), _("sh_unix_device_readable"));
    38673861  else
    3868     SL_RETURN( (-1), _("sh_unix_file_exists"));
     3862    SL_RETURN( (-1), _("sh_unix_device_readable"));
    38693863}
    38703864
Note: See TracChangeset for help on using the changeset viewer.