From 52e9fee3dd1d4d6dad8f268770412bcd7720026f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 5 Apr 2015 13:40:12 +0000 Subject: [PATCH] com_init(): Return negative on errors --- afs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/afs.c b/afs.c index a5ec7b2f..0c615747 100644 --- a/afs.c +++ b/afs.c @@ -1033,7 +1033,7 @@ out: exit(EXIT_FAILURE); } -static int create_tables_callback(int fd, const struct osl_object *query) +static int com_init_callback(int fd, const struct osl_object *query) { uint32_t table_mask = *(uint32_t *)query->data; int i, ret; @@ -1054,16 +1054,18 @@ static int create_tables_callback(int fd, const struct osl_object *query) if (!t->create) continue; ret = t->create(database_dir); - if (ret < 0) + if (ret < 0) { + para_printf(&pb, "cannot create table %s\n", t->name); goto out; + } para_printf(&pb, "successfully created %s table\n", t->name); } ret = open_afs_tables(); -out: if (ret < 0) - para_printf(&pb, "%s\n", para_strerror(-ret)); + para_printf(&pb, "cannot open afs tables\n"); +out: flush_and_free_pb(&pb); - return 0; + return ret; } int com_init(struct command_context *cc) @@ -1091,7 +1093,7 @@ int com_init(struct command_context *cc) return -E_BAD_TABLE_NAME; } } - return send_callback_request(create_tables_callback, &query, + return send_callback_request(com_init_callback, &query, afs_cb_result_handler, cc); } -- 2.30.2