BenjaminKeil: Tome 2.3.5 introduces error in src/modules.c#module_reset_dir_aux

  1. Install a module, e.g. Theme
  2. Try to start that module

The game closes immediately after step 2 with error message "Unable to create module dir /theme".

The problem is in the module_reset_dir_aux() function:

static void module_reset_dir_aux(cptr *dir, cptr new_path)
{
        char buf[1024];

        /* Build the new path */
        strnfmt(buf, sizeof (buf), "%s%s%s", dir, PATH_SEP, new_path);

        string_free(*dir);
        *dir = string_make(buf);

        /* Make it if needed */
        if (!private_check_user_directory(*dir))
                quit(format("Unable to create module dir %s\n", *dir));
}

Notice that dir is of type cptr *, but strnfmt is expecting an argument of type cptr; dir needs to be dereferenced:

static void module_reset_dir_aux(cptr *dir, cptr new_path)
{
        char buf[1024];

        /* Build the new path */
        strnfmt(buf, sizeof (buf), "%s%s%s", *dir, PATH_SEP, new_path);

        string_free(*dir);
        *dir = string_make(buf);

        /* Make it if needed */
        if (!private_check_user_directory(*dir))
                quit(format("Unable to create module dir %s\n", *dir));
}

NeilStevens: Fixed in the next version, thank you.

SigSegv: This was supposed to be resolved with the patch from bug 624, but apparently that patch was not correctly applied. The code has now been corrected.

BugReport913 (last edited 2008-06-19 21:49:42 by SigSegv)