]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aft.c
com_check(): Return negative on errors
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index 96e0ab9ab2a0142f564d4a9387b1a6a92dfcea9d..0207705f858a3beb77c98a6a7e0e6a2c123e68b6 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -2458,12 +2458,10 @@ static int com_setatt_callback(int fd, const struct osl_object *query)
        if (ret < 0)
                goto out;
        if (pmd.num_matches == 0)
-               para_printf(&cad.pb, "no matches\n");
+               ret = -E_NO_MATCH;
 out:
-       if (ret < 0)
-               para_printf(&cad.pb, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&cad.pb);
-       return 0;
+       return ret;
 }
 
 int com_setatt(struct command_context *cc)
@@ -2508,7 +2506,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;
@@ -2520,7 +2518,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));
@@ -2548,12 +2546,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) {
@@ -2563,9 +2562,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;
 }
 
 /**