Since /sys/class/net/ethX is not a symlink, readlink would always fail,
but that was erroneously taken as an indication that the interface
was present!  So, none of the other ways of specifying an hba would
be tried.  

For the fnic driver, we need to specify the hba as hostX or by WWN.

Use stat(2) instead of readlink(2) to determine whether
/sys/class/net/ethX is present.

Signed-off-by: Joe Eykholt <[email protected]>
---
 fcping.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/fcping.c b/fcping.c
index 4e3fa68..ca17963 100644
--- a/fcping.c
+++ b/fcping.c
@@ -446,6 +446,7 @@ fp_find_hba(void)
        HBA_ADAPTERATTRIBUTES hba_attrs;
        HBA_PORTATTRIBUTES port_attrs;
        HBA_UINT32 fcid = 0;
+       struct stat statbuf;
        char namebuf[1028];
        char hba_dir[256];
        fc_wwn_t wwn = 0;
@@ -466,7 +467,7 @@ fp_find_hba(void)
         */
 
        snprintf(hba_dir, sizeof(hba_dir), SYSFS_HBA_DIR "/%s", fp_hba);
-       if (readlink(hba_dir, namebuf, sizeof(namebuf) - 1)) {
+       if (!stat(hba_dir, &statbuf)) {
                fp_hba_type = FP_HBA_ETH_TYPE;
        } else if (strstr(fp_hba, "host") == fp_hba) {
                i = strtoul(fp_hba + 4, &endptr, 10);


_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to