int ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
if (ret < 0) {
- para_printf(pb, "failed to get mood definition: %s\n",
- para_strerror(-ret));
+ para_printf(pb, "cannot read mood\n");
return ret;
}
if (!*mood_name) /* ignore dummy row */
ret = for_each_line(FELF_READ_ONLY, mood_def.data, mood_def.size,
parse_mood_line, &mlpd);
if (ret < 0)
- para_printf(pb, "%s line %u: %s\n", mood_name, mlpd.line_num,
- para_strerror(-ret));
+ para_printf(pb, "mood %s: error in line %u: %s\n", mood_name,
+ mlpd.line_num, para_strerror(-ret));
+ ret = 1; /* don't fail the loop on invalid mood definitions */
out:
osl_close_disk_object(&mood_def);
return ret;
* \param fd The afs socket.
* \param query Unused.
*
- * \return Currently this function always returns zero.
+ * \return Negative on fatal errors. Inconsistent mood definitions are not
+ * considered an error.
*/
int mood_check_callback(int fd, __a_unused const struct osl_object *query)
{
+ int ret;
struct para_buffer pb = {
.max_size = shm_get_shmmax(),
.private_data = &(struct afs_max_size_handler_data) {
};
para_printf(&pb, "checking moods...\n");
- osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
- check_mood);
+ ret = osl(osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
+ check_mood));
flush_and_free_pb(&pb);
- return 0;
+ return ret;
}
static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)