All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ipmi-fru-parser v2] Replacing std::ifstream by access(2) for checking file existence
@ 2016-05-31  6:20 OpenBMC Patches
  2016-05-31  6:20 ` OpenBMC Patches
  0 siblings, 1 reply; 3+ messages in thread
From: OpenBMC Patches @ 2016-05-31  6: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] 3+ messages in thread

* [PATCH ipmi-fru-parser v2] Replacing std::ifstream by access(2) for checking file existence
  2016-05-31  6:20 [PATCH ipmi-fru-parser v2] Replacing std::ifstream by access(2) for checking file existence OpenBMC Patches
@ 2016-05-31  6:20 ` OpenBMC Patches
  2016-05-31 21:17   ` Patrick Williams
  0 siblings, 1 reply; 3+ messages in thread
From: OpenBMC Patches @ 2016-05-31  6: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..6ca1f16 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;
         fru_area->set_present(present);
 
         // Only setup dbus path for areas defined in BMC.
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH ipmi-fru-parser v2] Replacing std::ifstream by access(2) for checking file existence
  2016-05-31  6:20 ` OpenBMC Patches
@ 2016-05-31 21:17   ` Patrick Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Williams @ 2016-05-31 21:17 UTC (permalink / raw)
  To: OpenBMC Patches; +Cc: openbmc

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

On Tue, May 31, 2016 at 01: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..6ca1f16 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;

We need to make an assessment on when to use STL interfaces vs when to
use direct syscalls in C++ programs. I don't have any problem with this
change now without any direction.

Prefer to either write this as:
    - access(..) == 0
    - access(..) >= 0


>          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

-- 
Patrick Williams

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-31 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31  6:20 [PATCH ipmi-fru-parser v2] Replacing std::ifstream by access(2) for checking file existence OpenBMC Patches
2016-05-31  6:20 ` OpenBMC Patches
2016-05-31 21:17   ` Patrick Williams

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.