From: Andre Noll <maan@tuebingen.mpg.de>
Date: Sun, 5 Apr 2015 02:30:10 +0000 (+0000)
Subject: Do not check the return value of para_printf().
X-Git-Tag: v0.5.6~94^2~31
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=2edd5e54e7443ed42d4c4e56c2efb242956f818b;p=paraslash.git

Do not check the return value of para_printf().

This function rarely fails, and if it does, we don't care too much. On
the other hand, checking the return value of each call to para_printf()
clutters the code considerably, especially in the error paths where
there is already an error code we have to keep.

This commit simply removes all error checking for para_printf(),
resulting in code which is easier to follow and less error-prone.
---

diff --git a/afs.c b/afs.c
index 53fa5379..eb848089 100644
--- a/afs.c
+++ b/afs.c
@@ -575,11 +575,11 @@ static void com_select_callback(int fd, const struct osl_object *query)
 		.max_size_handler = afs_max_size_handler,
 	};
 	char *arg = query->data;
-	int num_admissible, ret, ret2;
+	int num_admissible, ret;
 
 	ret = clear_score_table();
 	if (ret < 0) {
-		ret2 = para_printf(&pb, "%s\n", para_strerror(-ret));
+		para_printf(&pb, "%s\n", para_strerror(-ret));
 		goto out;
 	}
 	if (current_play_mode == PLAY_MODE_MOOD)
@@ -588,21 +588,21 @@ static void com_select_callback(int fd, const struct osl_object *query)
 		playlist_close();
 	ret = activate_mood_or_playlist(arg, &num_admissible);
 	if (ret < 0) {
-		ret2 = para_printf(&pb, "%s\nswitching back to %s\n",
+		para_printf(&pb, "%s\nswitching back to %s\n",
 			para_strerror(-ret), current_mop?
 			current_mop : "dummy");
 		ret = activate_mood_or_playlist(current_mop, &num_admissible);
 		if (ret < 0) {
-			if (ret2 >= 0)
-				ret2 = para_printf(&pb, "failed, switching to dummy\n");
+			para_printf(&pb, "failed (%s), switching to dummy\n",
+				para_strerror(-ret));
 			activate_mood_or_playlist(NULL, &num_admissible);
 		}
 	} else
-		ret2 = para_printf(&pb, "activated %s (%d admissible files)\n",
+		para_printf(&pb, "activated %s (%d admissible files)\n",
 			current_mop?  current_mop : "dummy mood",
 			num_admissible);
 out:
-	if (ret2 >= 0 && pb.offset)
+	if (pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
 	free(pb.buf);
 }
diff --git a/aft.c b/aft.c
index 96f65e99..206be9e3 100644
--- a/aft.c
+++ b/aft.c
@@ -820,22 +820,17 @@ static int print_chunk_table(struct ls_data *d, struct para_buffer *b)
 		AFTCOL_CHUNKS, &chunk_table_obj));
 	if (ret < 0)
 		return ret;
-	ret = para_printf(b, "%s\n"
+	para_printf(b, "%s\n"
 		"chunk_time: %lu:%lu\nchunk_offsets: ",
 		d->path,
 		(long unsigned) d->afhi.chunk_tv.tv_sec,
 		(long unsigned) d->afhi.chunk_tv.tv_usec
 	);
-	if (ret < 0)
-		goto out;
 	buf = chunk_table_obj.data;
-	for (i = 0; i <= d->afhi.chunks_total; i++) {
-		ret = para_printf(b, "%u ", (unsigned) read_u32(buf + 4 * i));
-		if (ret < 0)
-			goto out;
-	}
-	ret = para_printf(b, "\n");
-out:
+	for (i = 0; i <= d->afhi.chunks_total; i++)
+		para_printf(b, "%u ", (unsigned) read_u32(buf + 4 * i));
+	para_printf(b, "\n");
+	ret = 1;
 	osl_close_disk_object(&chunk_table_obj);
 	return ret;
 }
@@ -860,7 +855,8 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
 	char asc_hash[2 * HASH_SIZE + 1];
 
 	if (opts->mode == LS_MODE_SHORT) {
-		ret = para_printf(b, "%s\n", d->path);
+		para_printf(b, "%s\n", d->path);
+		ret = 1;
 		goto out;
 	}
 	if (opts->mode == LS_MODE_CHUNKS) {
@@ -881,12 +877,10 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
 	if (opts->mode == LS_MODE_LONG) {
 		struct ls_widths *w = &opts->widths;
 		if (opts->flags & LS_FLAG_ADMISSIBLE_ONLY) {
-			ret = para_printf(b, "%*li ",
-				opts->widths.score_width, d->score);
-			if (ret < 0)
-				goto out;
+			para_printf(b, "%*li ", opts->widths.score_width,
+				d->score);
 		}
-		ret = para_printf(b,
+		para_printf(b,
 			"%s "   /* attributes */
 			"%*u "  /* amp */
 			"%*d "  /* image_id  */
@@ -913,18 +907,17 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
 			last_played_time,
 			d->path
 		);
+		ret = 1;
 		goto out;
 	}
 	if (opts->mode == LS_MODE_MBOX) {
 		const char *bn = para_basename(d->path);
-		ret = para_printf(b,
+		para_printf(b,
 			"From foo@localhost %s\n"
 			"Received: from\nTo: bar\nFrom: a\n"
 			"Subject: %s\n\n",
 			last_played_time,
 			bn? bn : "?");
-		if (ret < 0)
-			goto out;
 	}
 	ret = write_filename_items(b, d->path, opts->flags);
 	if (ret < 0)
@@ -1004,7 +997,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
 		struct osl_object lyrics_def;
 		lyr_get_def_by_id(afsi->lyrics_id, &lyrics_def);
 		if (lyrics_def.data) {
-			ret = para_printf(b, "Lyrics:\n~~~~~~~\n%s",
+			para_printf(b, "Lyrics:\n~~~~~~~\n%s",
 				(char *)lyrics_def.data);
 			osl_close_disk_object(&lyrics_def);
 		}
@@ -1719,19 +1712,15 @@ static void com_add_callback(int fd, const struct osl_object *query)
 		goto out;
 	if (hs && pb && hs == pb && !(flags & ADD_FLAG_FORCE)) {
 		if (flags & ADD_FLAG_VERBOSE)
-			ret = para_printf(&msg, "ignoring duplicate\n");
-		else
-			ret = 1;
+			para_printf(&msg, "ignoring duplicate\n");
+		ret = 1;
 		goto out;
 	}
 	if (hs && hs != pb) {
 		struct osl_object obj;
 		if (pb) { /* hs trumps pb, remove pb */
-			if (flags & ADD_FLAG_VERBOSE) {
-				ret = para_printf(&msg, "removing %s\n", path);
-				if (ret < 0)
-					goto out;
-			}
+			if (flags & ADD_FLAG_VERBOSE)
+				para_printf(&msg, "removing %s\n", path);
 			afs_event(AUDIO_FILE_REMOVE, &msg, pb);
 			ret = osl(osl_del_row(audio_file_table, pb));
 			if (ret < 0)
@@ -1744,9 +1733,7 @@ static void com_add_callback(int fd, const struct osl_object *query)
 				AFTCOL_PATH, &obj));
 			if (ret < 0)
 				goto out;
-			ret = para_printf(&msg, "renamed from %s\n", (char *)obj.data);
-			if (ret < 0)
-				goto out;
+			para_printf(&msg, "renamed from %s\n", (char *)obj.data);
 		}
 		ret = osl(osl_update_object(audio_file_table, hs, AFTCOL_PATH,
 			&objs[AFTCOL_PATH]));
@@ -1774,12 +1761,9 @@ static void com_add_callback(int fd, const struct osl_object *query)
 		if (ret < 0)
 			goto out;
 		hash_to_asc(old_hash, old_asc);
-		if (flags & ADD_FLAG_VERBOSE) {
-			ret = para_printf(&msg, "file change: %s -> %s\n",
-				old_asc, asc);
-			if (ret < 0)
-				goto out;
-		}
+		if (flags & ADD_FLAG_VERBOSE)
+			para_printf(&msg, "file change: %s -> %s\n", old_asc,
+				asc);
 		ret = osl_update_object(audio_file_table, pb, AFTCOL_HASH,
 			&objs[AFTCOL_HASH]);
 		if (ret < 0)
@@ -1788,11 +1772,8 @@ static void com_add_callback(int fd, const struct osl_object *query)
 	if (hs || pb) { /* (hs != NULL and pb != NULL) implies hs == pb */
 		struct osl_row *row = pb? pb : hs;
 		/* update afhi and chunk_table */
-		if (flags & ADD_FLAG_VERBOSE) {
-			ret = para_printf(&msg, "updating afhi and chunk table\n");
-			if (ret < 0)
-				goto out;
-		}
+		if (flags & ADD_FLAG_VERBOSE)
+			para_printf(&msg, "updating afhi and chunk table\n");
 		ret = osl(osl_update_object(audio_file_table, row, AFTCOL_AFHI,
 			&objs[AFTCOL_AFHI]));
 		if (ret < 0)
@@ -1805,11 +1786,8 @@ static void com_add_callback(int fd, const struct osl_object *query)
 		goto out;
 	}
 	/* new entry, use default afsi */
-	if (flags & ADD_FLAG_VERBOSE) {
-		ret = para_printf(&msg, "new file\n");
-		if (ret < 0)
-			goto out;
-	}
+	if (flags & ADD_FLAG_VERBOSE)
+		para_printf(&msg, "new file\n");
 	default_afsi.last_played = time(NULL) - 365 * 24 * 60 * 60;
 	default_afsi.audio_format_id = read_u8(buf + CAB_AUDIO_FORMAT_OFFSET);
 
@@ -2057,28 +2035,26 @@ static int touch_audio_file(__a_unused struct osl_table *table,
 	struct afsi_change_event_data aced;
 
 	ret = get_afsi_object_of_row(row, &obj);
-	if (ret < 0)
-		return para_printf(&tad->pb, "%s: %s\n", name, para_strerror(-ret));
+	if (ret < 0) {
+		para_printf(&tad->pb, "%s: %s\n", name, para_strerror(-ret));
+		return ret;
+	}
 	ret = load_afsi(&old_afsi, &obj);
-	if (ret < 0)
-		return para_printf(&tad->pb, "%s: %s\n", name, para_strerror(-ret));
+	if (ret < 0) {
+		para_printf(&tad->pb, "%s: %s\n", name, para_strerror(-ret));
+		return ret;
+	}
 	new_afsi = old_afsi;
 	if (no_options) {
 		new_afsi.num_played++;
 		new_afsi.last_played = time(NULL);
-		if (tad->cto->flags & TOUCH_FLAG_VERBOSE) {
-			ret = para_printf(&tad->pb, "%s: num_played = %u, "
+		if (tad->cto->flags & TOUCH_FLAG_VERBOSE)
+			para_printf(&tad->pb, "%s: num_played = %u, "
 				"last_played = now()\n", name,
 				new_afsi.num_played);
-			if (ret < 0)
-				return ret;
-		}
 	} else {
-		if (tad->cto->flags & TOUCH_FLAG_VERBOSE) {
-			ret = para_printf(&tad->pb, "touching %s\n", name);
-			if (ret < 0)
-				return ret;
-		}
+		if (tad->cto->flags & TOUCH_FLAG_VERBOSE)
+			para_printf(&tad->pb, "touching %s\n", name);
 		if (tad->cto->lyrics_id >= 0)
 			new_afsi.lyrics_id = tad->cto->lyrics_id;
 		if (tad->cto->image_id >= 0)
@@ -2109,7 +2085,7 @@ static void com_touch_callback(int fd, const struct osl_object *query)
 			.max_size_handler = afs_max_size_handler
 		}
 	};
-	int ret, ret2 = 0;
+	int ret;
 	struct pattern_match_data pmd = {
 		.table = audio_file_table,
 		.loop_col_num = AFTCOL_HASH,
@@ -2123,10 +2099,10 @@ static void com_touch_callback(int fd, const struct osl_object *query)
 		pmd.fnmatch_flags |= FNM_PATHNAME;
 	ret = for_each_matching_row(&pmd);
 	if (ret < 0)
-		ret2 = para_printf(&tad.pb, "%s\n", para_strerror(-ret));
+		para_printf(&tad.pb, "%s\n", para_strerror(-ret));
 	else if (pmd.num_matches == 0)
-		ret2 = para_printf(&tad.pb, "no matches\n");
-	if (ret2 >= 0 && tad.pb.offset)
+		para_printf(&tad.pb, "no matches\n");
+	if (tad.pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, tad.pb.buf, tad.pb.offset);
 	free(tad.pb.buf);
 }
@@ -2229,11 +2205,8 @@ static int remove_audio_file(__a_unused struct osl_table *table,
 	struct com_rm_action_data *crd = data;
 	int ret;
 
-	if (crd->flags & RM_FLAG_VERBOSE) {
-		ret = para_printf(&crd->pb, "removing %s\n", name);
-		if (ret < 0)
-			return ret;
-	}
+	if (crd->flags & RM_FLAG_VERBOSE)
+		para_printf(&crd->pb, "removing %s\n", name);
 	afs_event(AUDIO_FILE_REMOVE, &crd->pb, row);
 	ret = osl(osl_del_row(audio_file_table, row));
 	if (ret < 0)
@@ -2271,11 +2244,9 @@ static void com_rm_callback(int fd, const struct osl_object *query)
 		return;
 	}
 	if ((pmd.num_matches == 0) && !(crd.flags & RM_FLAG_FORCE))
-		ret = para_printf(&crd.pb, "no matches -- nothing removed\n");
-	else if (crd.flags & RM_FLAG_VERBOSE) {
-		ret = para_printf(&crd.pb, "removed %u files\n",
-			pmd.num_matches);
-	}
+		para_printf(&crd.pb, "no matches -- nothing removed\n");
+	else if (crd.flags & RM_FLAG_VERBOSE)
+		para_printf(&crd.pb, "removed %u files\n", pmd.num_matches);
 	if (ret >= 0 && crd.pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, crd.pb.buf, crd.pb.offset);
 	free(crd.pb.buf);
@@ -2374,11 +2345,8 @@ static int copy_selector_info(__a_unused struct osl_table *table,
 	if (cad->flags & CPSI_FLAG_COPY_ATTRIBUTES)
 		target_afsi.attributes = cad->source_afsi.attributes;
 	save_afsi(&target_afsi, &target_afsi_obj); /* in-place update */
-	if (cad->flags & CPSI_FLAG_VERBOSE) {
-		ret = para_printf(&cad->pb, "copied afsi to %s\n", name);
-		if (ret < 0)
-			return ret;
-	}
+	if (cad->flags & CPSI_FLAG_VERBOSE)
+		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);
@@ -2618,7 +2586,7 @@ int send_afs_status(struct command_context *cc, int parser_friendly)
 		afs_cb_result_handler, cc);
 }
 
-/* TODO: optionally fix problems by removing offending rows */
+/* returns success even on errors to keep the loop going */
 static int check_audio_file(struct osl_row *row, void *data)
 {
 	char *path;
@@ -2628,34 +2596,28 @@ static int check_audio_file(struct osl_row *row, void *data)
 	struct afs_info afsi;
 	char *blob_name;
 
-	if (ret < 0)
-		return para_printf(pb, "%s\n", para_strerror(-ret));
-	if (stat(path, &statbuf) < 0) {
-		ret = para_printf(pb, "%s: stat error (%s)\n", path, strerror(errno));
-		if (ret < 0)
-			return ret;
-	} else {
-		if (!S_ISREG(statbuf.st_mode)) {
-			ret = para_printf(pb, "%s: not a regular file\n", path);
-			if (ret < 0)
-				return ret;
-		}
+	if (ret < 0) {
+		para_printf(pb, "%s\n", para_strerror(-ret));
+		return 0;
 	}
+	if (stat(path, &statbuf) < 0)
+		para_printf(pb, "%s: stat error (%s)\n", path, strerror(errno));
+	else if (!S_ISREG(statbuf.st_mode))
+		para_printf(pb, "%s: not a regular file\n", path);
 	ret = get_afsi_of_row(row, &afsi);
-	if (ret < 0)
-		return para_printf(pb, "%s: %s\n", path, para_strerror(-ret));
-	ret = lyr_get_name_by_id(afsi.lyrics_id, &blob_name);
 	if (ret < 0) {
-		ret = para_printf(pb, "%s lyrics id %u: %s\n", path, afsi.lyrics_id,
-			para_strerror(-ret));
-		if (ret < 0)
-			return ret;
+		para_printf(pb, "%s: %s\n", path, para_strerror(-ret));
+		return 1;
 	}
+	ret = lyr_get_name_by_id(afsi.lyrics_id, &blob_name);
+	if (ret < 0)
+		para_printf(pb, "%s lyrics id %u: %s\n", path, afsi.lyrics_id,
+			para_strerror(-ret));
 	ret = img_get_name_by_id(afsi.image_id, &blob_name);
 	if (ret < 0)
-		ret = para_printf(pb, "%s image id %u: %s\n", path, afsi.image_id,
+		para_printf(pb, "%s image id %u: %s\n", path, afsi.image_id,
 			para_strerror(-ret));
-	return ret;
+	return 0;
 }
 
 /**
@@ -2678,10 +2640,7 @@ void aft_check_callback(int fd, __a_unused const struct osl_object *query)
 		},
 		.max_size_handler = afs_max_size_handler
 	};
-	int ret = para_printf(&pb, "checking audio file table...\n");
-
-	if (ret < 0)
-		return;
+	para_printf(&pb, "checking audio file table...\n");
 	audio_file_loop(&pb, check_audio_file);
 	if (pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
@@ -2761,11 +2720,9 @@ static int aft_event_handler(enum afs_events event, struct para_buffer *pb,
 	switch (event) {
 	case ATTRIBUTE_REMOVE: {
 		const struct rmatt_event_data *red = data;
-		ret = para_printf(pb, "clearing attribute %s (bit %u) from all "
+		para_printf(pb, "clearing attribute %s (bit %u) from all "
 			"entries in the audio file table\n", red->name,
 			red->bitnum);
-		if (ret < 0)
-			return ret;
 		return audio_file_loop(data, clear_attribute);
 	} case AFSI_CHANGE: {
 		struct afsi_change_event_data *aced = data;
diff --git a/attribute.c b/attribute.c
index e73a0e76..435f22b5 100644
--- a/attribute.c
+++ b/attribute.c
@@ -135,15 +135,18 @@ static int print_attribute(struct osl_table *table, struct osl_row *row,
 	struct osl_object bitnum_obj;
 	int ret;
 
-	if (!(laad->flags & LSATT_FLAG_LONG))
-		return para_printf(&laad->pb, "%s\n", name);
+	if (!(laad->flags & LSATT_FLAG_LONG)) {
+		para_printf(&laad->pb, "%s\n", name);
+		return 1;
+	}
 	ret = osl(osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj));
 	if (ret < 0) {
 		para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret));
 		return ret;
 	}
-	return para_printf(&laad->pb, "%u\t%s\n", *(unsigned char*)bitnum_obj.data,
+	para_printf(&laad->pb, "%u\t%s\n", *(unsigned char*)bitnum_obj.data,
 		name);
+	return 1;
 }
 
 static void com_lsatt_callback(int fd, const struct osl_object *query)
@@ -225,7 +228,7 @@ struct addatt_event_data {
 static void com_addatt_callback(int fd, const struct osl_object *query)
 {
 	char *p;
-	int ret = 1, ret2 = 0;
+	int ret = 1;
 	struct para_buffer pb = {
 		.max_size = shm_get_shmmax(),
 		.private_data = &(struct afs_max_size_handler_data) {
@@ -244,16 +247,12 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
 
 		len = strlen(p);
 		if (!len || p[len - 1] == '-' || p[len - 1] == '+') {
-			ret2 = para_printf(&pb, "invalid attribute name: %s\n", p);
-			if (ret2 < 0)
-				goto out;
+			para_printf(&pb, "invalid attribute name: %s\n", p);
 			continue;
 		}
 		ret = get_attribute_bitnum_by_name(p, &bitnum);
 		if (ret >= 0) {
-			ret2 = para_printf(&pb, "attribute \"%s\" already exists\n", p);
-			if (ret2 < 0)
-				goto out;
+			para_printf(&pb, "attribute \"%s\" already exists\n", p);
 			continue;
 		}
 		if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* error */
@@ -285,7 +284,7 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
 		greatest_att_bitnum = PARA_MAX(greatest_att_bitnum, (int)bitnum);
 	}
 out:
-	if (ret < 0 && ret2 >= 0)
+	if (ret < 0)
 		para_printf(&pb, "%s: %s\n", p, para_strerror(-ret));
 	if (pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
@@ -361,6 +360,7 @@ struct remove_attribute_action_data {
 	uint64_t mask_of_removed_atts;
 };
 
+/* returns succcess even on errors to keep the loop going */
 static int remove_attribute(struct osl_table *table, struct osl_row *row,
 		const char *name, void *data)
 {
@@ -369,16 +369,20 @@ static int remove_attribute(struct osl_table *table, struct osl_row *row,
 	struct rmatt_event_data red = {.name = name};
 
 	ret = get_attribute_bitnum_by_name(name, &red.bitnum);
-	if (ret < 0)
-		return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+	if (ret < 0) {
+		para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+		return 0;
+	}
 	ret = osl(osl_del_row(table, row));
-	if (ret < 0)
-		return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
-	ret = para_printf(&raad->pb, "removed attribute %s\n", name);
+	if (ret < 0) {
+		para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
+		return 0;
+	}
+	para_printf(&raad->pb, "removed attribute %s\n", name);
 	raad->num_removed++;
 	raad->mask_of_removed_atts |= (1 << red.bitnum);
 	afs_event(ATTRIBUTE_REMOVE, &raad->pb, &red);
-	return ret;
+	return 1;
 }
 
 static void com_rmatt_callback(int fd, const struct osl_object *query)
@@ -394,7 +398,7 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
 			.max_size_handler = afs_max_size_handler,
 		}
 	};
-	int ret, ret2 = 0;
+	int ret;
 	struct pattern_match_data pmd = {
 		.table = attribute_table,
 		.patterns = *query,
@@ -405,10 +409,10 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
 	};
 	ret = for_each_matching_row(&pmd);
 	if (ret < 0)
-		ret2 = para_printf(&raad.pb, "%s\n", para_strerror(-ret));
+		para_printf(&raad.pb, "%s\n", para_strerror(-ret));
 	else if (!raad.num_removed)
-		ret2 = para_printf(&raad.pb, "no match -- nothing removed\n");
-	if (ret2 >= 0 && raad.pb.offset)
+		para_printf(&raad.pb, "no match -- nothing removed\n");
+	if (raad.pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, raad.pb.buf, raad.pb.offset);
 	free(raad.pb.buf);
 }
diff --git a/blob.c b/blob.c
index 3073bf00..4f4a034a 100644
--- a/blob.c
+++ b/blob.c
@@ -116,15 +116,18 @@ static int print_blob(struct osl_table *table, struct osl_row *row,
 	uint32_t id;
 	int ret;
 
-	if (!(lbad->flags & BLOB_LS_FLAG_LONG))
-		return para_printf(&lbad->pb, "%s\n", name);
+	if (!(lbad->flags & BLOB_LS_FLAG_LONG)) {
+		para_printf(&lbad->pb, "%s\n", name);
+		return 0;
+	}
 	ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
 	if (ret < 0) {
 		para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
 		return ret;
 	}
 	id = *(uint32_t *)obj.data;
-	return para_printf(&lbad->pb, "%u\t%s\n", id, name);
+	para_printf(&lbad->pb, "%u\t%s\n", id, name);
+	return 1;
 }
 
 static void com_lsblob_callback(struct osl_table *table,
@@ -265,7 +268,7 @@ static int remove_blob(struct osl_table *table, struct osl_row *row,
 static void com_rmblob_callback(struct osl_table *table, int fd,
 		const struct osl_object *query)
 {
-	int ret, ret2 = 0;
+	int ret;
 	struct rmblob_data rmbd = {
 		.pb = {
 			.max_size = shm_get_shmmax(),
@@ -286,19 +289,15 @@ static void com_rmblob_callback(struct osl_table *table, int fd,
 		.action = remove_blob
 	};
 	ret = for_each_matching_row(&pmd);
-	if (ret < 0) {
-		ret2 = para_printf(&rmbd.pb, "%s\n", para_strerror(-ret));
-		if (ret2 < 0)
-			goto out;
-	}
+	if (ret < 0)
+		para_printf(&rmbd.pb, "%s\n", para_strerror(-ret));
 	if (pmd.num_matches == 0)
-		ret2 = para_printf(&rmbd.pb, "no matches, nothing removed\n");
+		para_printf(&rmbd.pb, "no matches, nothing removed\n");
 	else {
-		ret2 = para_printf(&rmbd.pb, "removed %d blobs\n", pmd.num_matches);
+		para_printf(&rmbd.pb, "removed %d blobs\n", pmd.num_matches);
 		afs_event(BLOB_RENAME, NULL, table);
 	}
-out:
-	if (ret2 >= 0 && rmbd.pb.offset)
+	if (rmbd.pb.offset)
 		pass_buffer_as_shm(fd, SBD_OUTPUT, rmbd.pb.buf, rmbd.pb.offset);
 	free(rmbd.pb.buf);
 }
diff --git a/mood.c b/mood.c
index 8d171bde..cbb2f438 100644
--- a/mood.c
+++ b/mood.c
@@ -416,9 +416,7 @@ static int check_mood(struct osl_row *mood_row, void *data)
 	}
 	if (!*mood_name) /* ignore dummy row */
 		goto out;
-	ret = para_printf(pb, "checking mood %s...\n", mood_name);
-	if (ret < 0)
-		goto out;
+	para_printf(pb, "checking mood %s...\n", mood_name);
 	ret = for_each_line(FELF_READ_ONLY, mood_def.data, mood_def.size,
 		parse_mood_line, &mlpd);
 	if (ret < 0)
@@ -446,9 +444,7 @@ void mood_check_callback(int fd, __a_unused const struct osl_object *query)
 		.max_size_handler = afs_max_size_handler
 	};
 
-	int ret = para_printf(&pb, "checking moods...\n");
-	if (ret < 0)
-		return;
+	para_printf(&pb, "checking moods...\n");
 	osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
 		check_mood);
 	if (pb.offset)
diff --git a/playlist.c b/playlist.c
index 0aa4d9c1..46333a00 100644
--- a/playlist.c
+++ b/playlist.c
@@ -95,9 +95,9 @@ static int check_playlist_path(char *path, void *data)
 	struct osl_row *aft_row;
 	int ret = aft_get_row_of_path(path, &aft_row);
 
-	if (ret >= 0)
-		return 1;
-	return para_printf(pb, "%s: %s\n", path, para_strerror(-ret));
+	if (ret < 0)
+		para_printf(pb, "%s: %s\n", path, para_strerror(-ret));
+	return 1; /* do not fail the loop on bad paths */
 }
 
 static int check_playlist(struct osl_row *row, void *data)
@@ -107,18 +107,18 @@ static int check_playlist(struct osl_row *row, void *data)
 	char *playlist_name;
 	int ret = pl_get_name_and_def_by_row(row, &playlist_name, &playlist_def);
 
-	if (ret < 0)
-		return para_printf(pb, "failed to get playlist data: %s\n",
+	if (ret < 0) { /* log error, but continue */
+		para_printf(pb, "failed to get playlist data: %s\n",
 			para_strerror(-ret));
+		return 1;
+	}
 	if (*playlist_name) { /* skip dummy row */
-		ret = para_printf(pb, "checking playlist %s...\n", playlist_name);
-		if (ret < 0)
-			return ret;
-		ret = for_each_line(FELF_READ_ONLY, playlist_def.data,
+		para_printf(pb, "checking playlist %s...\n", playlist_name);
+		for_each_line(FELF_READ_ONLY, playlist_def.data,
 			playlist_def.size, check_playlist_path, pb);
 	}
 	osl_close_disk_object(&playlist_def);
-	return ret;
+	return 1;
 }
 
 /**
@@ -137,10 +137,7 @@ void playlist_check_callback(int fd, __a_unused const struct osl_object *query)
 		},
 		.max_size_handler = afs_max_size_handler,
 	};
-	int ret = para_printf(&pb, "checking playlists...\n");
-
-	if (ret < 0)
-		return;
+	para_printf(&pb, "checking playlists...\n");
 	osl_rbtree_loop(playlists_table, BLOBCOL_ID, &pb,
 		check_playlist);
 	if (pb.offset)