Commit ea734f49 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra Committed by Alessandro Rubini

wrsw_hal: SFPs can use full 16 byte names

parent c40cd72d
......@@ -589,7 +589,7 @@ int shw_sfp_read_db(char *filename)
lua_pop(L, 1);
sfp = malloc(sizeof(struct shw_sfp_caldata));
strcpy(sfp->part_num, sfp_pn);
strncpy(sfp->part_num, sfp_pn, sizeof(sfp->part_num));
if (!sfp_vs || strcmp(sfp_vs, "") == 0) {
sfp->vendor_serial[0] = 0;
sfp->flags |= SFP_FLAG_CLASS_DATA;
......@@ -639,9 +639,9 @@ struct shw_sfp_caldata *shw_sfp_get_cal_data(int num)
/* In the first pass, look for serial number */
while (t) {
// printf("search1 %s %s\n", t->part_num, t->vendor_serial);
if (strcmp(pn, t->part_num) == 0 && strcmp(t->vendor_serial, "") == 0)
if (strncmp(pn, t->part_num, 16) == 0 && strncmp(t->vendor_serial, "", 16) == 0)
other = t;
else if (strcmp(pn, t->part_num) == 0 && strcmp(vs, t->vendor_serial) == 0)
else if (strncmp(pn, t->part_num, 16) == 0 && strncmp(vs, t->vendor_serial, 16) == 0)
return t;
t = t->next;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment