handler: Fix getBMInstanceProperty to read spaces
std::getline should be used to avoid terminating the read when there are
spaces.
Tested:
Before:
~# cat /run/bm-instance/asset-tag
testing space
~# ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x17 0x00
79 2b 00 17 07 74 65 73 74 69 6e 67
After:
~# cat /run/bm-instance/asset-tag
testing space
~# ipmitool raw 0x2e 0x32 0x79 0x2b 0x00 0x17 0x00
79 2b 00 17 0d 74 65 73 74 69 6e 67 20 73 70 61 63 65
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Ia13880e385150487dfe07c4aabf7b3edc814ccf0
diff --git a/handler.cpp b/handler.cpp
index bc6323d..8786e29 100644
--- a/handler.cpp
+++ b/handler.cpp
@@ -795,14 +795,13 @@
throw IpmiException(::ipmi::ccInvalidFieldRequest);
}
- // If file exists, read up to 64 bytes (normally shouldn't be more than 32)
std::ifstream ifs;
ifs.exceptions(std::ifstream::failbit);
std::string property;
try
{
ifs.open(opath);
- ifs >> std::setw(64) >> property;
+ std::getline(ifs, property);
}
catch (std::ios_base::failure& fail)
{