This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 8/9] Fix useless error message


If source.Cached() is empty, we produce the amazingly helpful error message
"Can't open (null) for reading: No such file".

Improve the error message so it reports that we can't open the archive since
we don't know a filename for the locally cached archive file.

This can occur if download failed for an archive, but we chose to continue.
---
 install.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/install.cc b/install.cc
index 79ddd20..f8f0b59 100644
--- a/install.cc
+++ b/install.cc
@@ -366,7 +366,14 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
 
   io_stream *pkgfile = NULL;
 
-  if (!source.Cached() || !io_stream::exists (source.Cached ())
+  if (!source.Cached())
+    {
+      note (NULL, IDS_ERR_OPEN_READ, source.Canonical (), "Unknown filename");
+      ++errors;
+      return;
+    }
+
+  if (!io_stream::exists (source.Cached ())
       || !(pkgfile = io_stream::open (source.Cached (), "rb", 0)))
     {
       note (NULL, IDS_ERR_OPEN_READ, source.Cached (), "No such file");
-- 
2.12.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]