[PATCH ipmi-fru-parser] Replacing std::ifstream by access(2) for checking file existence

Vishwanatha Subbanna vishwanath at in.ibm.com
Tue May 31 16:15:34 AEST 2016


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 at in.ibm.com
----------------------------------------------------------------------------------

"openbmc" <openbmc-bounces+vishwanath=in.ibm.com at lists.ozlabs.org> wrote on
31/05/2016 04:51:02 am:

> From: Samuel Mendoza-Jonas <sam at mendozajonas.com>
> To: OpenBMC Patches <openbmc-patches at stwcx.xyz>
> Cc: openbmc at 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 at lists.ozlabs.org>
>
> On Mon, May 30, 2016 at 03:20:14AM -0500, OpenBMC Patches wrote:
> > From: vishwa <vishwanath at 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 at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/openbmc
>
> _______________________________________________
> openbmc mailing list
> openbmc at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20160531/3011ca8c/attachment.html>


More information about the openbmc mailing list