From 78e11df57fc16cb63f10e73b3f0427cfef445a3c Mon Sep 17 00:00:00 2001 From: "jaehoon.you" Date: Tue, 2 Apr 2013 20:55:28 +0900 Subject: [PATCH] Fix and Add some error message 1. In some cases, lthor needs enough memory (Reported by Vyacheslav Barinov in SRR) So, notify message added. 2. fix print format about error message. Change-Id: I42fcea8c21d4183e8909293d2101cebd19ef9dc5 Signed-off-by: jaehoon.you --- lthor.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lthor.c b/lthor.c index 27df43d..c6fb121 100755 --- a/lthor.c +++ b/lthor.c @@ -897,6 +897,7 @@ int download_pitfile(int fd, const char *pitfile) if (r < 0) { fprintf(stderr, "line %d: failed to download %s\n", __LINE__, pitfile); + filedata_close(&filedata); return r; } @@ -927,9 +928,12 @@ int download_single_tarfile(int fd, const char *tarfile) printf("[\x1b[0;32;1m%s\x1b[0m]\n", filename); r = download_single_file(fd, &tardata.src, BINARY_TYPE_NORMAL); if (r < 0) { - fprintf(stderr, "line %d: failed to download %s\n", - __LINE__, filename); - break; + fprintf(stderr, "line %d: failed to download %s\n", __LINE__, filename); + fprintf(stderr, "\nIn some cases, lthor needs enough memory\n"); + fprintf(stderr, "Please check free memory in your Host PC "); + fprintf(stderr, "and unload some heavy applications\n"); + tardata_close(&tardata); + return r; } } @@ -1001,7 +1005,7 @@ int process_download(const char *portname, const char *pitfile, char **tarfileli fprintf(stderr, "\nDownload PIT file : %s\n\n", pitfile); r = download_pitfile(fd, pitfile); if (r < 0) { - fprintf(stderr, "failed to download %s\n", pitfile); + fprintf(stderr, "\nfailed to download %s\n", pitfile); close(fd); return r; } @@ -1011,7 +1015,7 @@ int process_download(const char *portname, const char *pitfile, char **tarfileli fprintf(stderr, "\nDownload files from %s\n\n", *tarfilelist); r = download_single_tarfile(fd, *tarfilelist); if (r < 0) { - fprintf(stderr, "failed to download %s\n", *tarfilelist); + fprintf(stderr, "\nfailed to download %s\n", *tarfilelist); close(fd); return r; } -- 2.34.1