• Christian Walther's avatar
    extmod/vfs_posix: Fix getcwd() on non-root VFS. · be28829a
    Christian Walther authored
    
    
    The unwritten API contract expected of a VFS.getcwd() by mp_vfs_getcwd()
    is that its return value should be either "" or "/" when the CWD is at
    the root of the VFS and otherwise start with a slash and not end with a
    slash. This was not correctly implemented in VfsPosix for instances with
    a non-empty root - the required leading slash, if any, was cut off
    because the root length includes a trailing slash. This would result in
    missing slashes in the middle of the return value of os.getcwd() or in
    uninitialized garbage from beyond a string's null terminator when the
    CWD was at the VFS root.
    Signed-off-by: default avatarChristian Walther <cwalther@gmx.ch>
    be28829a
vfs_posix.c 14.9 KB