* [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence
@ 2016-05-30 8:20 OpenBMC Patches
2016-05-30 8:20 ` OpenBMC Patches
0 siblings, 1 reply; 4+ messages in thread
From: OpenBMC Patches @ 2016-05-30 8:20 UTC (permalink / raw)
To: openbmc
Fixes problem reported by issue https://github.com/openbmc/ipmi-fru-parser/issues/12
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/ipmi-fru-parser/17)
<!-- Reviewable:end -->
https://github.com/openbmc/ipmi-fru-parser/pull/17
vishwa (1):
Replacing std::ifstream by access(2) for checking file existence
writefrudata.C | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.8.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence
2016-05-30 8:20 [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence OpenBMC Patches
@ 2016-05-30 8:20 ` OpenBMC Patches
2016-05-30 23:21 ` Samuel Mendoza-Jonas
0 siblings, 1 reply; 4+ messages in thread
From: OpenBMC Patches @ 2016-05-30 8:20 UTC (permalink / raw)
To: openbmc
From: vishwa <vishwanath@in.ibm.com>
---
writefrudata.C | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/writefrudata.C b/writefrudata.C
index 7ee2127..6e28341 100644
--- a/writefrudata.C
+++ b/writefrudata.C
@@ -663,7 +663,7 @@ int ipmi_validate_fru_area(const uint8_t fruid, const char *fru_file_name,
(fruid, get_fru_area_type(fru_entry), bus_type, bmc_fru);
// Physically being present
- bool present = std::ifstream(fru_file_name);
+ bool present = (access(fru_file_name, F_OK) != -1) ? true : false;
fru_area->set_present(present);
// Only setup dbus path for areas defined in BMC.
--
2.8.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence
2016-05-30 8:20 ` OpenBMC Patches
@ 2016-05-30 23:21 ` Samuel Mendoza-Jonas
2016-05-31 6:15 ` Vishwanatha Subbanna
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Mendoza-Jonas @ 2016-05-30 23:21 UTC (permalink / raw)
To: OpenBMC Patches; +Cc: openbmc
On Mon, May 30, 2016 at 03:20:14AM -0500, OpenBMC Patches wrote:
> From: vishwa <vishwanath@in.ibm.com>
>
> ---
> writefrudata.C | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/writefrudata.C b/writefrudata.C
> index 7ee2127..6e28341 100644
> --- a/writefrudata.C
> +++ b/writefrudata.C
> @@ -663,7 +663,7 @@ int ipmi_validate_fru_area(const uint8_t fruid, const char *fru_file_name,
> (fruid, get_fru_area_type(fru_entry), bus_type, bmc_fru);
>
> // Physically being present
> - bool present = std::ifstream(fru_file_name);
> + bool present = (access(fru_file_name, F_OK) != -1) ? true : false;
Hi Vishwa,
Since (access(..) != -1) returns a boolean you can simplify this to:
bool present = access(fru_file_name, F_OK) != -1;
> fru_area->set_present(present);
>
> // Only setup dbus path for areas defined in BMC.
> --
> 2.8.3
>
>
> _______________________________________________
> openbmc mailing list
> openbmc@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence
2016-05-30 23:21 ` Samuel Mendoza-Jonas
@ 2016-05-31 6:15 ` Vishwanatha Subbanna
0 siblings, 0 replies; 4+ messages in thread
From: Vishwanatha Subbanna @ 2016-05-31 6:15 UTC (permalink / raw)
To: Samuel Mendoza-Jonas; +Cc: OpenBMC Patches, openbmc
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
hello Sam,
Thanks for the review and suggestion.. I refreshed the pull request.
Thanks
-------------------------------------------------------------------------------------
Thanks and Regards,
Vishwanath.
Advisory Software Engineer,
Power Firmware Development,
Systems &Technology Lab,
MG2-6F-255 , Manyata Embassy Business Park,
Bangalore , KA , 560045
Ph: +91-80-46678255
E-mail: vishwanath@in.ibm.com
----------------------------------------------------------------------------------
"openbmc" <openbmc-bounces+vishwanath=in.ibm.com@lists.ozlabs.org> wrote on
31/05/2016 04:51:02 am:
> From: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> To: OpenBMC Patches <openbmc-patches@stwcx.xyz>
> Cc: openbmc@lists.ozlabs.org
> Date: 31/05/2016 04:52 am
> Subject: Re: [PATCH ipmi-fru-parser] Replacing std::ifstream by
> access(2) for checking file existence
> Sent by: "openbmc" <openbmc-bounces
+vishwanath=in.ibm.com@lists.ozlabs.org>
>
> On Mon, May 30, 2016 at 03:20:14AM -0500, OpenBMC Patches wrote:
> > From: vishwa <vishwanath@in.ibm.com>
> >
> > ---
> > writefrudata.C | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/writefrudata.C b/writefrudata.C
> > index 7ee2127..6e28341 100644
> > --- a/writefrudata.C
> > +++ b/writefrudata.C
> > @@ -663,7 +663,7 @@ int ipmi_validate_fru_area(const uint8_t
> fruid, const char *fru_file_name,
> > (fruid, get_fru_area_type(fru_entry),
> bus_type, bmc_fru);
> >
> > // Physically being present
> > - bool present = std::ifstream(fru_file_name);
> > + bool present = (access(fru_file_name, F_OK) != -1) ? true :
false;
>
> Hi Vishwa,
>
> Since (access(..) != -1) returns a boolean you can simplify this to:
>
> bool present = access(fru_file_name, F_OK) != -1;
>
> > fru_area->set_present(present);
> >
> > // Only setup dbus path for areas defined in BMC.
> > --
> > 2.8.3
> >
> >
> > _______________________________________________
> > openbmc mailing list
> > openbmc@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/openbmc
>
> _______________________________________________
> openbmc mailing list
> openbmc@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc
[-- Attachment #2: Type: text/html, Size: 3185 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-31 6:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-30 8:20 [PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence OpenBMC Patches
2016-05-30 8:20 ` OpenBMC Patches
2016-05-30 23:21 ` Samuel Mendoza-Jonas
2016-05-31 6:15 ` Vishwanatha Subbanna
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.