Changeset 52acfab in mainline for uspace/lib/c/generic/dirent.c


Ignore:
Timestamp:
2019-05-28T19:24:14Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77de449e
Parents:
af5037d (diff), bebd154 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-28 19:24:14)
git-committer:
GitHub <noreply@…> (2019-05-28 19:24:14)
Message:

Merge pull request #161 from le-jzr/cxxcompat2

C++ compatibility improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/dirent.c

    raf5037d r52acfab  
    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;
Note: See TracChangeset for help on using the changeset viewer.