Re: [Powertop] [PATCH] catch fstream exceptions in lib routines
Lekensteyn <lekensteyn at gmail.com> Fri, 18 May 2012 12:58:10 +0200
| Newsgroups | dev.linux.lists.powertop |
|---|---|
| Message-ID | <1403259.dDrcVdOxix@penguin> |
On Friday 18 May 2012 13:17:39 Sergey Senozhatsky wrote:
Hi,
> @@ -187,10 +192,17 @@ int read_sysfs(const string &filename, bool *ok)
> *ok = false;
> return 0;
> }
> - file >> i;
> + try
> + {
> + file >> i;
> + if (ok)
> + *ok = true;
> + } catch (std::exception &exc) {
> + if (ok)
> + *ok = "false";
I have changed this to false (without quotes), I guess that is what you meant.
With that change,
Tested-by: Lekensteyn <lekensteyn(a)gmail.com>
Thanks,
Peter