X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=aft.c;h=9f6c4e29826eb9b403882d8d4c9d5775988fe942;hb=fe282244d61b83eb1f285259dd1d55992a96288f;hp=c255b245fdf0209f0c8b09ba0b28310fddcb8fa5;hpb=9602629057e1016f8ca7dfa2aae1477e4faece65;p=paraslash.git diff --git a/aft.c b/aft.c index c255b245..9f6c4e29 100644 --- a/aft.c +++ b/aft.c @@ -1072,7 +1072,9 @@ again: * No need to update the status items as the AFSI_CHANGE event will * recreate them. */ - afs_event(AFSI_CHANGE, NULL, &aced); + ret = afs_event(AFSI_CHANGE, NULL, &aced); + if (ret < 0) + goto out; ret = save_afd(afd); out: free(afd->afhi.chunk_table); @@ -1658,7 +1660,9 @@ static int com_add_callback(int fd, const struct osl_object *query) if (pb) { /* hs trumps pb, remove pb */ if (flags & ADD_FLAG_VERBOSE) para_printf(&msg, "removing %s\n", path); - afs_event(AUDIO_FILE_REMOVE, &msg, pb); + ret = afs_event(AUDIO_FILE_REMOVE, &msg, pb); + if (ret < 0) + goto out; ret = osl(osl_del_row(audio_file_table, pb)); if (ret < 0) goto out; @@ -1676,7 +1680,9 @@ static int com_add_callback(int fd, const struct osl_object *query) &objs[AFTCOL_PATH])); if (ret < 0) goto out; - afs_event(AUDIO_FILE_RENAME, &msg, hs); + ret = afs_event(AUDIO_FILE_RENAME, &msg, hs); + if (ret < 0) + goto out; if (!(flags & ADD_FLAG_FORCE)) goto out; } @@ -1719,7 +1725,9 @@ static int com_add_callback(int fd, const struct osl_object *query) &objs[AFTCOL_CHUNKS])); if (ret < 0) goto out; - afs_event(AFHI_CHANGE, &msg, row); + ret = afs_event(AFHI_CHANGE, &msg, row); + if (ret < 0) + goto out; goto out; } /* new entry, use default afsi */ @@ -1732,7 +1740,7 @@ static int com_add_callback(int fd, const struct osl_object *query) objs[AFTCOL_AFSI].size = AFSI_SIZE; save_afsi(&default_afsi, &objs[AFTCOL_AFSI]); ret = osl(osl_add_and_get_row(audio_file_table, objs, &aft_row)); - afs_event(AUDIO_FILE_ADD, &msg, aft_row); + ret = afs_event(AUDIO_FILE_ADD, &msg, aft_row); out: if (ret < 0) para_printf(&msg, "could not add %s\n", path); @@ -2007,8 +2015,7 @@ static int touch_audio_file(__a_unused struct osl_table *table, save_afsi(&new_afsi, &obj); /* in-place update */ aced.aft_row = row; aced.old_afsi = &old_afsi; - afs_event(AFSI_CHANGE, &tad->pb, &aced); - return 1; + return afs_event(AFSI_CHANGE, &tad->pb, &aced); } static int com_touch_callback(int fd, const struct osl_object *query) @@ -2139,7 +2146,9 @@ static int remove_audio_file(__a_unused struct osl_table *table, if (crd->flags & RM_FLAG_VERBOSE) para_printf(&crd->pb, "removing %s\n", name); - afs_event(AUDIO_FILE_REMOVE, &crd->pb, row); + ret = afs_event(AUDIO_FILE_REMOVE, &crd->pb, row); + if (ret < 0) + return ret; ret = osl(osl_del_row(audio_file_table, row)); if (ret < 0) para_printf(&crd->pb, "cannot remove %s\n", name); @@ -2276,8 +2285,7 @@ static int copy_selector_info(__a_unused struct osl_table *table, para_printf(&cad->pb, "copied afsi to %s\n", name); aced.aft_row = row; aced.old_afsi = &old_afsi; - afs_event(AFSI_CHANGE, &cad->pb, &aced); - return 1; + return afs_event(AFSI_CHANGE, &cad->pb, &aced); } static int com_cpsi_callback(int fd, const struct osl_object *query) @@ -2398,8 +2406,7 @@ static int change_atts(__a_unused struct osl_table *table, new_afsi.attributes |= cad->add_mask; new_afsi.attributes &= ~cad->del_mask; save_afsi(&new_afsi, &obj); /* in-place update */ - afs_event(AFSI_CHANGE, &cad->pb, &aced); - return 1; + return afs_event(AFSI_CHANGE, &cad->pb, &aced); } static int com_setatt_callback(int fd, const struct osl_object *query) @@ -2506,7 +2513,7 @@ int send_afs_status(struct command_context *cc, int parser_friendly) afs_cb_result_handler, cc); } -/* returns success even on errors to keep the loop going */ +/* returns success on non-fatal errors to keep the loop going */ static int check_audio_file(struct osl_row *row, void *data) { char *path; @@ -2518,7 +2525,7 @@ static int check_audio_file(struct osl_row *row, void *data) if (ret < 0) { para_printf(pb, "%s\n", para_strerror(-ret)); - return 0; + return ret; } if (stat(path, &statbuf) < 0) para_printf(pb, "%s: stat error (%s)\n", path, strerror(errno)); @@ -2546,12 +2553,13 @@ static int check_audio_file(struct osl_row *row, void *data) * \param fd The afs socket. * \param query Unused. * - * \return This function always returns zero. + * \return Standard. Inconsistencies are reported but not regarded as an error. * * \sa com_check(). */ int aft_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) { @@ -2561,9 +2569,9 @@ int aft_check_callback(int fd, __a_unused const struct osl_object *query) .max_size_handler = afs_max_size_handler }; para_printf(&pb, "checking audio file table...\n"); - audio_file_loop(&pb, check_audio_file); + ret = audio_file_loop(&pb, check_audio_file); flush_and_free_pb(&pb); - return 0; + return ret; } /**