Skip to content

Commit

Permalink
Fixed calculateUserDir() to prevent extra dir separator insertion in …
Browse files Browse the repository at this point in the history
…default case.
  • Loading branch information
icculus committed Apr 2, 2002
1 parent 85ec84e commit 21a2eda
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions physfs.c
Expand Up @@ -279,12 +279,12 @@ static char *calculateUserDir(void)

str = (uname != NULL) ? uname : "default";
retval = (char *) malloc(strlen(baseDir) + strlen(str) +
(strlen(dirsep) * 2) + 6);
strlen(dirsep) + 6);

if (retval == NULL)
__PHYSFS_setError(ERR_OUT_OF_MEMORY);
else
sprintf(retval, "%s%susers%s%s", baseDir, dirsep, dirsep, str);
sprintf(retval, "%susers%s%s", baseDir, dirsep, str);

if (uname != NULL)
free((void *) uname);
Expand Down Expand Up @@ -398,7 +398,6 @@ int PHYSFS_init(const char *argv0)
char *ptr;

BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(!__PHYSFS_platformInit(), NULL, 0);

BAIL_IF_MACRO(!initializeMutexes(), NULL, 0);
Expand Down

0 comments on commit 21a2eda

Please sign in to comment.