openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/lib/path.c
DIR* ul_path_opendir(struct path_cxt* pc, const char* path)
{
    DIR* dir;
    int fd = -1;

    if (path)
        fd = ul_path_open(pc, O_RDONLY | O_CLOEXEC, path);
    else if (pc->dir_path)
    {
        DBG(CXT, ul_debugobj(pc, "duplicate dir path"));
        fd = dup_fd_cloexec(ul_path_get_dirfd(pc), STDERR_FILENO + 1);
    }

    if (fd < 0)
        return NULL;

    dir = fdopendir(fd);
    if (!dir)
    {
        close(fd);
        return NULL;
    }
    if (!path)
        rewinddir(dir);
    return dir;
}
/*
 * Open directory @path in read-onl mode. If the path is NULL then duplicate FD
 * to the directory addressed by @pc.
 */
Open directory @path in read-onl mode. If the path is NULL then duplicate FD
to the directory addressed by @pc.
Open directory @path in read - onl mode . If the path is NULL then duplicate FD to the directory addressed by @pc .
DIR* ul_path_opendir(struct path_cxt* pc, const char* path)
{
    DIR* dir;
    int fd = -1;
    if (path)
        fd = ul_path_open(pc, O_RDONLY | O_CLOEXEC, path);
    else if (pc->dir_path)
    {
        DBG(CXT, ul_debugobj(pc, "duplicate dir path"));
        fd = dup_fd_cloexec(ul_path_get_dirfd(pc), STDERR_FILENO + 1);
    }
    if (fd < 0)
        return NULL;
    dir = fdopendir(fd);
    if (!dir)
    {
        close(fd);
        return NULL;
    }
    if (!path)
        rewinddir(dir);
    return dir;
}
DIR * ul_path_opendir ( struct path_cxt * pc , const char * path ) { DIR * dir ; int fd = -1 ; if ( path ) fd = ul_path_open ( pc , O_RDONLY | O_CLOEXEC , path ) ; else if ( pc -> dir_path ) { DBG ( CXT , ul_debugobj ( pc , " " ) ) ; fd = dup_fd_cloexec ( ul_path_get_dirfd ( pc ) , STDERR_FILENO + 1 ) ; } if ( fd < 0 ) return NULL ; dir = fdopendir ( fd ) ; if ( ! dir ) { close ( fd ) ; return NULL ; } if ( ! path ) rewinddir ( dir ) ; return dir ; }
Open directory @path in read-onl mode.
Open directory @path in read - onl mode .