diff --git a/cli/fabric.c b/cli/fabric.c index 165bd0ba..253ca645 100644 --- a/cli/fabric.c +++ b/cli/fabric.c @@ -22,6 +22,8 @@ * */ +#ifdef __linux__ + #include "commands.h" #include "argconfig.h" #include "common.h" @@ -2041,3 +2043,5 @@ static struct subcommand subcmd = { }; REGISTER_SUBCMD(subcmd); + +#endif //__linux__ diff --git a/lib/platform/linux.c b/lib/platform/linux.c index 26a8a737..dc05505f 100644 --- a/lib/platform/linux.c +++ b/lib/platform/linux.c @@ -267,10 +267,14 @@ int switchtec_list(struct switchtec_device_info **devlist) static int linux_get_device_id(struct switchtec_dev *dev) { + int ret; char link_path[PATH_MAX]; + struct switchtec_linux *ldev = to_switchtec_linux(dev); - snprintf(link_path, sizeof(link_path), "%s/%s/device/device", - sys_path, basename(dev->name)); + ret = dev_to_sysfs_path(ldev, "device/device", link_path, + sizeof(link_path)); + if (ret) + return ret; return sysfs_read_int(link_path, 16); } diff --git a/lib/switchtec.c b/lib/switchtec.c index 24b6f0ad..f163f5c0 100644 --- a/lib/switchtec.c +++ b/lib/switchtec.c @@ -1123,7 +1123,7 @@ static int log_a_to_file(struct switchtec_dev *dev, int sub_cmd_id, cmd.start = res.hdr.next_start; } - ret = read; + ret = 0; ret_free_log_defs: free_log_defs(&defs); @@ -1157,7 +1157,7 @@ static int log_b_to_file(struct switchtec_dev *dev, int sub_cmd_id, int fd) cmd.offset = htole32(read); } - return read; + return 0; } static int log_c_to_file(struct switchtec_dev *dev, int sub_cmd_id, int fd)