Changeset 2326


Ignore:
Timestamp:
Sep 26, 2005, 4:36:28 AM (20 years ago)
Author:
bird
Message:

Use LIBC_FH::pszNativePath when available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/b_ioFHToPath.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2325 r2326  
    3232#include <stdlib.h>
    3333#include <errno.h>
    34 #include <math.h>
    35 #include <emx/umalloc.h>
     34#include <string.h>
    3635#include <emx/io.h>
    3736#include <InnoTekLIBC/backend.h>
     
    6665    if (rc)
    6766        LIBCLOG_ERROR_RETURN(rc, "ret %d - Invalid filehandle %d\n", rc, fh);
    68     if ((pFH->fFlags & __LIBC_FH_TYPEMASK) != F_FILE)
    69         LIBCLOG_ERROR_RETURN(-ENOSYS, "ret -ENOSYS - Filetype %08x is notsupported by this api, filehandle %d\n", pFH->fFlags & __LIBC_FH_TYPEMASK, fh);
     67
     68    if (pFH->pszNativePath)
     69    {
     70        size_t cch = strlen(pFH->pszNativePath) + 1;
     71        if (cch <= cchPath)
     72        {
     73            memcpy(pszPath, pFH->pszNativePath, cch);
     74            LIBCLOG_RETURN_INT(0);
     75        }
     76
     77        memcpy(pszPath, pFH->pszNativePath, cchPath);
     78        pszPath[cchPath - 1] = '\0';
     79        LIBCLOG_ERROR_RETURN(-EOVERFLOW, "ret -EOVERFLOW - cch=%d cchPath=%d '%s'\n", cch, cchPath, pFH->pszNativePath);
     80    }
     81
    7082
    7183    /*
Note: See TracChangeset for help on using the changeset viewer.