You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
From c36b20b7dc2e787f7285e459851df1a74368e8e3 Mon Sep 17 00:00:00 2001 |
|
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> |
|
Date: Wed, 20 Sep 2017 16:52:35 +0530 |
|
Subject: [PATCH] lsvpd: Add workaround for std::ios_base::failure' issue |
|
|
|
Recently on P9 we started seeing below error. |
|
|
|
#vpdupdate |
|
terminate called after throwing an instance of 'std::ios_base::failure' |
|
what(): basic_filebuf::underflow error reading the file |
|
Aborted (core dumped) |
|
|
|
It turns out that we needed c++ fix. Lets add workaround so that we |
|
don't crash. |
|
|
|
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> |
|
Reviewed-by: Ankit Kumar <ankit@linux.vnet.ibm.com> |
|
--- |
|
src/internal/sys_interface/icollector.cpp | 11 +++++++++++ |
|
1 file changed, 11 insertions(+) |
|
|
|
diff --git a/src/internal/sys_interface/icollector.cpp b/src/internal/sys_interface/icollector.cpp |
|
index 0d48c93..d6407d9 100644 |
|
--- a/src/internal/sys_interface/icollector.cpp |
|
+++ b/src/internal/sys_interface/icollector.cpp |
|
@@ -104,6 +104,17 @@ namespace lsvpd |
|
*/ |
|
string ICollector::getBinaryData( const string& path ) |
|
{ |
|
+ struct stat sbuf; |
|
+ |
|
+ /* |
|
+ * Check file existence and size before calling ifstream |
|
+ * |
|
+ * Workaround for libstdc++ issue. |
|
+ * https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=250545 |
|
+ */ |
|
+ if ((stat(path.c_str(), &sbuf) != 0) || (sbuf.st_size == 0)) |
|
+ return ""; |
|
+ |
|
ifstream fi(path.c_str(), ios::binary); |
|
string str; |
|
|
|
-- |
|
2.13.5 |
|
|
|
|