Changeset 2408 for libcaca


Ignore:
Timestamp:
Jun 15, 2008, 3:50:11 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Set errno to ENOSYS in unsupported cucul_file_t operations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/file.c

    r2407 r2408  
    5454{
    5555#if defined __KERNEL__
     56    seterrno(ENOSYS);
    5657    return NULL;
    5758#else
    5859    cucul_file_t *fp = malloc(sizeof(*fp));
    5960
    60     fp->readonly = strchr(mode, 'r');
     61    fp->readonly = !!strchr(mode, 'r');
    6162
    6263#   if defined HAVE_ZLIB_H
     
    128129{
    129130#if defined __KERNEL__
     131    seterrno(ENOSYS);
    130132    return 0;
    131133#elif defined HAVE_ZLIB_H
     
    145147{
    146148#if defined __KERNEL__
     149    seterrno(ENOSYS);
    147150    return 0;
    148151#elif defined HAVE_ZLIB_H
     
    158161{
    159162#if defined __KERNEL__
     163    seterrno(ENOSYS);
    160164    return 0;
    161165#elif defined HAVE_ZLIB_H
     
    170174size_t cucul_file_write(cucul_file_t *fp, const void *ptr, size_t size)
    171175{
     176#if defined __KERNEL__
     177    seterrno(ENOSYS);
     178    return 0;
     179#else
    172180    if(fp->readonly)
    173181        return 0;
    174182
    175 #if defined __KERNEL__
    176     return 0;
    177 #elif defined HAVE_ZLIB_H
    178     /* FIXME: zip files are not supported */
     183#   if defined HAVE_ZLIB_H
     184    if(fp->zip)
     185    {
     186        /* FIXME: zip files are not supported */
     187        seterrno(ENOSYS);
     188        return 0;
     189    }
    179190    return gzwrite(fp->gz, ptr, size);
    180 #else
     191#   else
    181192    return fwrite(ptr, 1, size, fp->f);
     193#   endif
    182194#endif
    183195}
     
    186198{
    187199#if defined __KERNEL__
     200    seterrno(ENOSYS);
    188201    return NULL;
    189202#elif defined HAVE_ZLIB_H
Note: See TracChangeset for help on using the changeset viewer.