Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bebd154 in mainline


Ignore:
Timestamp:
2019-05-28T18:38:09Z (20 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
52acfab
Parents:
0d14c25
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-28 18:37:57)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-28 18:38:09)
Message:

Fix coastline gcc build

Not really sure why, but during gcc build the code in <dirent.h>
is missing the definition of NAME_MAX from <limits.h>, despite
<limits.h> being included.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • abi/include/limits.h

    r0d14c25 rbebd154  
    8484#define MB_LEN_MAX 4
    8585
    86 #define __NAME_MAX  256
    87 
    8886#ifdef _HELENOS_SOURCE
    8987#define UCHAR_MIN   0
     
    104102
    105103#define SSIZE_MAX  INTPTR_MAX
    106 #define NAME_MAX   __NAME_MAX
     104#define NAME_MAX   255
    107105
    108106#endif
  • uspace/lib/c/generic/dirent.c

    r0d14c25 rbebd154  
    3939#include <errno.h>
    4040#include <assert.h>
     41#include <string.h>
    4142
    4243struct __dirstream {
     
    9293        ssize_t len = 0;
    9394
    94         rc = vfs_read_short(dirp->fd, dirp->pos, &dirp->res.d_name[0],
    95             NAME_MAX + 1, &len);
     95        rc = vfs_read_short(dirp->fd, dirp->pos, dirp->res.d_name,
     96            sizeof(dirp->res.d_name), &len);
    9697        if (rc != EOK) {
    9798                errno = rc;
    9899                return NULL;
    99100        }
     101
     102        assert(strnlen(dirp->res.d_name, sizeof(dirp->res.d_name)) < sizeof(dirp->res.d_name));
    100103
    101104        dirp->pos += len;
  • uspace/lib/c/include/dirent.h

    r0d14c25 rbebd154  
    3636#define _LIBC_DIRENT_H_
    3737
    38 #include <limits.h>
    3938#include <_bits/decls.h>
    4039
     
    4241
    4342struct dirent {
    44         char d_name[__NAME_MAX + 1];
     43        char d_name[256];
    4544};
    4645
Note: See TracChangeset for help on using the changeset viewer.