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
int ul_path_read_string(struct path_cxt* pc, char** str, const char* path)
{
    char buf[BUFSIZ];
    int rc;

    *str = NULL;

    rc = ul_path_read(pc, buf, sizeof(buf) - 1, path);
    if (rc < 0 || !str)
        return rc;
    ;

    /* Remove tailing newline (usuall in sysfs) */
    if (rc > 0 && *(buf + rc - 1) == '\n')
        --rc;

    buf[rc] = '\0';
    *str = strdup(buf);
    if (!*str)
        rc = -ENOMEM;

    return rc;
}
/*
 * Returns newly allocated buffer with data from file. Maximal size is BUFSIZ
 * (send patch if you need something bigger;-)
 *
 * Returns size of the string!
 */
Returns newly allocated buffer with data from file. Maximal size is BUFSIZ
(send patch if you need something bigger;-)

Returns size of the string!
Returns newly allocated buffer with data from file . Maximal size is BUFSIZ ( send patch if you need something bigger ; - ) Returns size of the string!
int ul_path_read_string(struct path_cxt* pc, char** str, const char* path)
{
    char buf[BUFSIZ];
    int rc;
    *str = NULL;
    rc = ul_path_read(pc, buf, sizeof(buf) - 1, path);
    if (rc < 0 || !str)
        return rc;
    ;
    if (rc > 0 && *(buf + rc - 1) == '\n')
        --rc;
    buf[rc] = '\0';
    *str = strdup(buf);
    if (!*str)
        rc = -ENOMEM;
    return rc;
}
int ul_path_read_string ( struct path_cxt * pc , char * * str , const char * path ) { char buf [ BUFSIZ ] ; int rc ; * str = NULL ; rc = ul_path_read ( pc , buf , sizeof ( buf ) - 1 , path ) ; if ( rc < 0 || ! str ) return rc ; ; if ( rc > 0 && * ( buf + rc - 1 ) == ' \n ' ) -- rc ; buf [ rc ] = ' \0 ' ; * str = strdup ( buf ) ; if ( ! * str ) rc = - ENOMEM ; return rc ; }
Returns newly allocated buffer with data from file.
Returns newly allocated buffer with data from file .
/* Remove tailing newline (usuall in sysfs) */