Skip to content
Permalink
Browse files
More proper error reporting.
  • Loading branch information
icculus committed May 25, 2002
1 parent 2cc2477 commit 56cbc659da4c61db7decd32516b3fa7a2b3dad0f
Showing with 23 additions and 10 deletions.
  1. +23 −10 physfs.c
@@ -1005,11 +1005,13 @@ const char *PHYSFS_getRealDir(const char *filename)
DirHandle *h = i->dirHandle;
if (__PHYSFS_verifySecurity(h, filename))
{
if (h->funcs->exists(h, filename))
if (!h->funcs->exists(h, filename))
__PHYSFS_setError(ERR_NO_SUCH_FILE);
else
{
__PHYSFS_platformReleaseMutex(stateLock);
return(i->dirName);
} /* if */
} /* else */
} /* if */
} /* for */
__PHYSFS_platformReleaseMutex(stateLock);
@@ -1163,17 +1165,24 @@ PHYSFS_sint64 PHYSFS_getLastModTime(const char *fname)
DirHandle *h = i->dirHandle;
if (__PHYSFS_verifySecurity(h, fname))
{
if (h->funcs->exists(h, fname))
if (!h->funcs->exists(h, fname))
__PHYSFS_setError(ERR_NO_SUCH_FILE);
else
{
PHYSFS_sint64 retval = h->funcs->getLastModTime(h, fname);
PHYSFS_sint64 retval = -1;
if (h->funcs->getLastModTime == NULL)
__PHYSFS_setError(ERR_NOT_SUPPORTED);
else
retval = h->funcs->getLastModTime(h, fname);

__PHYSFS_platformReleaseMutex(stateLock);
return(retval);
} /* if */
} /* else */
} /* if */
} /* for */
__PHYSFS_platformReleaseMutex(stateLock);

return(0);
return(-1); /* error set in verifysecurity/exists */
} /* PHYSFS_getLastModTime */


@@ -1194,12 +1203,14 @@ int PHYSFS_isDirectory(const char *fname)
DirHandle *h = i->dirHandle;
if (__PHYSFS_verifySecurity(h, fname))
{
if (h->funcs->exists(h, fname))
if (!h->funcs->exists(h, fname))
__PHYSFS_setError(ERR_NO_SUCH_FILE);
else
{
int retval = h->funcs->isDirectory(h, fname);
__PHYSFS_platformReleaseMutex(stateLock);
return(retval);
} /* if */
} /* else */
} /* if */
} /* for */
__PHYSFS_platformReleaseMutex(stateLock);
@@ -1225,12 +1236,14 @@ int PHYSFS_isSymbolicLink(const char *fname)
DirHandle *h = i->dirHandle;
if (__PHYSFS_verifySecurity(h, fname))
{
if (h->funcs->exists(h, fname))
if (!h->funcs->exists(h, fname))
__PHYSFS_setError(ERR_NO_SUCH_FILE);
else
{
int retval = h->funcs->isSymLink(h, fname);
__PHYSFS_platformReleaseMutex(stateLock);
return(retval);
} /* if */
} /* else */
} /* if */
} /* for */
__PHYSFS_platformReleaseMutex(stateLock);

0 comments on commit 56cbc65

Please sign in to comment.