]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Invalidate table pointers on shutdown.
authorAndre Noll <maan@systemlinux.org>
Sat, 15 Sep 2007 16:32:32 +0000 (18:32 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 15 Sep 2007 16:32:32 +0000 (18:32 +0200)
This caused a segfault when com_init() was invoked twice because
osl was trying to close an already closed table.

Also, add a bunch of error descriptions.

aft.c
attribute.c
error.h
score.c

diff --git a/aft.c b/aft.c
index 40dc1d920dcc5b9abbe59cb21277559336f0f3ab..0b07fa17145bcabfb48a0dc2ac3d277b62ece897 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -69,7 +69,7 @@ int load_afsi(struct afs_info *afsi, struct osl_object *obj)
 {
        char *buf = obj->data;
        if (obj->size < AFSI_SIZE)
-               return -E_BAD_AFS;
+               return -E_BAD_AFSI;
        afsi->last_played = read_u64(buf + AFSI_LAST_PLAYED_OFFSET);
        afsi->attributes = read_u64(buf + AFSI_ATTRIBUTES_OFFSET);
        afsi->num_played = read_u32(buf + AFSI_NUM_PLAYED_OFFSET);
@@ -1704,6 +1704,7 @@ err:
 void aft_shutdown(enum osl_close_flags flags)
 {
        osl_close_table(audio_file_table, flags);
+       audio_file_table = NULL;
 }
 
 /**
index af3dfb063be01ea0a8ec8c63cde0457d0dd5a600..f33987271d7b5352c03a9eddbf8438da8cbe505f 100644 (file)
@@ -377,6 +377,7 @@ err:
 void attribute_shutdown(enum osl_close_flags flags)
 {
        osl_close_table(attribute_table, flags);
+       attribute_table = NULL;
 }
 
 int attribute_init(struct table_info *ti, const char *db)
diff --git a/error.h b/error.h
index 5763f528740399f50f8da3596d860d9e8a7dbb9f..19f00d2113af4036def403ca3b24315910f93d0d 100644 (file)
--- a/error.h
+++ b/error.h
@@ -112,19 +112,19 @@ extern const char **para_errlist[];
        PARA_ERROR(NO_COMPARE_FUNC, "fixme"), \
        PARA_ERROR(NULL_OBJECT, "fixme"), \
        PARA_ERROR(BAD_DATA_SIZE, "fixme"), \
-       PARA_ERROR(NOT_MAPPED, "fixme"), \
-       PARA_ERROR(ALREADY_MAPPED, "fixme"), \
+       PARA_ERROR(NOT_MAPPED, "file not mapped"), \
+       PARA_ERROR(ALREADY_MAPPED, "file already mapped"), \
        PARA_ERROR(BAD_SIZE, "fixme"), \
        PARA_ERROR(TRUNC, "fixme"), \
        PARA_ERROR(UNLINK, "fixme"), \
-       PARA_ERROR(EXIST, "fixme"), \
-       PARA_ERROR(ISDIR, "fixme"), \
-       PARA_ERROR(NOTDIR, "fixme"), \
+       PARA_ERROR(EXIST, "file or directory already exists"), \
+       PARA_ERROR(ISDIR, "error: is a directory"), \
+       PARA_ERROR(NOTDIR, "error: not a directory"), \
        PARA_ERROR(NOENT, "fixme"), \
        PARA_ERROR(OSL_PERM, "fixme"), \
        PARA_ERROR(BAD_TABLE, "table not open"), \
        PARA_ERROR(BAD_TABLE_HEADER, "table header corruption"), \
-       PARA_ERROR(BAD_TABLE_DESC, "fixme"), \
+       PARA_ERROR(BAD_TABLE_DESC, "invalid table description"), \
        PARA_ERROR(RB_KEY_EXISTS, "key already exists in rbtree"), \
        PARA_ERROR(RB_KEY_NOT_FOUND, "key not found in rbtree"), \
        PARA_ERROR(BAD_ID, "fixme"), \
@@ -158,10 +158,10 @@ extern const char **para_errlist[];
 
 
 #define AFS_ERRORS \
-       PARA_ERROR(AFS_SYNTAX, "fixme"), \
-       PARA_ERROR(FORK, "fixme"), \
-       PARA_ERROR(BAD_TABLE_NAME, "fixme"), \
-       PARA_ERROR(INPUT_TOO_LARGE, "fixme"), \
+       PARA_ERROR(AFS_SYNTAX, "afs syntax error"), \
+       PARA_ERROR(FORK, "fork error"), \
+       PARA_ERROR(BAD_TABLE_NAME, "invalid table"), \
+       PARA_ERROR(INPUT_TOO_LARGE, "input too large for stdin command"), \
 
 
 #define MOOD_ERRORS \
@@ -194,16 +194,16 @@ extern const char **para_errlist[];
 
 
 #define AFT_ERRORS \
-       PARA_ERROR(BAD_AFS, "fixme"), \
+       PARA_ERROR(BAD_AFSI, "invaid afs info"), \
        PARA_ERROR(LOCALTIME, "fixme"), \
        PARA_ERROR(STRFTIME, "fixme"), \
        PARA_ERROR(BAD_PATH, "invalid path"), \
        PARA_ERROR(BAD_SORT, "fixme"), \
        PARA_ERROR(FNMATCH, "fixme"), \
        PARA_ERROR(NO_MATCH, "no matches"), \
-       PARA_ERROR(NO_AFHI, "fixme"), \
-       PARA_ERROR(AFT_SYNTAX, "syntax error"), \
-       PARA_ERROR(HASH_MISMATCH, "fixme"), \
+       PARA_ERROR(NO_AFHI, "audio format handler info required"), \
+       PARA_ERROR(AFT_SYNTAX, "audio file table syntax error"), \
+       PARA_ERROR(HASH_MISMATCH, "hash mismatch, consider re-add"), \
 
 
 #define USER_LIST_ERRORS \
diff --git a/score.c b/score.c
index b53d60b38b582b6989f65fc290e894647e53f1f7..a044faa3e23991044763e5838ff45cc3e82d927f 100644 (file)
--- a/score.c
+++ b/score.c
@@ -342,6 +342,7 @@ int row_belongs_to_score_table(const struct osl_row *aft_row)
 void score_shutdown(enum osl_close_flags flags)
 {
        osl_close_table(score_table, flags | OSL_FREE_VOLATILE);
+       score_table = NULL;
 }
 
 /**