Bläddra i källkod

PHYSFS_init() should fail if argv0 is NULL and we can't do without it.

Ryan C. Gordon 19 år sedan
förälder
incheckning
4530776d5b
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      physfs.c

+ 5 - 0
physfs.c

@@ -662,6 +662,9 @@ static char *calculateBaseDir(const char *argv0)
     if (retval != NULL)
     if (retval != NULL)
         return(retval);
         return(retval);
 
 
+    /* we need argv0 to be sane to go on. */
+    BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, NULL);
+
     /*
     /*
      * Determine if there's a path on argv0. If there is, that's the base dir.
      * Determine if there's a path on argv0. If there is, that's the base dir.
      */
      */
@@ -684,6 +687,8 @@ static char *calculateBaseDir(const char *argv0)
         return(retval);
         return(retval);
     } /* if */
     } /* if */
 
 
+    /* !!! FIXME: should probably just fail here instead of being heroic. */
+
     /*
     /*
      * Last ditch effort: it's the current working directory. (*shrug*)
      * Last ditch effort: it's the current working directory. (*shrug*)
      */
      */