forked from github/server
fix test requiring a data directory (sigsegv)
This commit is contained in:
parent
e2b78cd8d8
commit
34580ab9fa
3 changed files with 5 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -41,3 +41,4 @@ Thumbs.db
|
|||
*.cfg
|
||||
*.cmd
|
||||
tmp/
|
||||
tests/config.lua
|
||||
|
|
|
@ -12,7 +12,7 @@ function test_store_unit()
|
|||
local u = unit.create(f, r, 1)
|
||||
local fid = f.id
|
||||
u:add_item("money", u.number * 100)
|
||||
local filename = config.basepath .. "/data/test.dat"
|
||||
local filename = "test.dat"
|
||||
store = storage.create(filename, "wb")
|
||||
assert_not_equal(store, nil)
|
||||
store:write_unit(u)
|
||||
|
|
|
@ -40,6 +40,9 @@ static int tolua_storage_create(lua_State * L)
|
|||
data->store = store;
|
||||
|
||||
F = fopen(filename, type);
|
||||
if (!F) {
|
||||
return 0;
|
||||
}
|
||||
if (strchr(type, 'r')) {
|
||||
fread(&data->version, sizeof(int), 1, F);
|
||||
fseek(F, sizeof(int), SEEK_CUR);
|
||||
|
|
Loading…
Reference in a new issue