[PATCH 2/2] tools: Stop converting file if write failed in seq2bseq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If write failed converted file would be broken. This make sure that
user is being informed about it.
---
 tools/seq2bseq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/seq2bseq.c b/tools/seq2bseq.c
index 9797f5f..7657a57 100644
--- a/tools/seq2bseq.c
+++ b/tools/seq2bseq.c
@@ -130,6 +130,7 @@ static void convert_file(const char *input_path, const char *output_path)
 
 	while (1) {
 		char *str;
+		int err;
 
 		str = fgets(line_buffer, line_size - 1, fp);
 		if (!str)
@@ -137,7 +138,12 @@ static void convert_file(const char *input_path, const char *output_path)
 
 		cur += strlen(str);
 
-		convert_line(fd, str);
+		err = convert_line(fd, str);
+		if (err < 0) {
+			fprintf(stderr, "Failed to convert file (%s)\n",
+								strerror(-err));
+			break;
+		}
 	}
 
 	fclose(fp);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux