*** multipath-tools-0.4.3-pre5/multipath/devinfo.c 2005-01-23 17:48:05.000000000 -0500 --- multipath-tools-0.4.3-pre5-patched/multipath/devinfo.c 2005-03-04 12:40:13.000000000 -0500 *************** *** 150,155 **** --- 150,156 ---- } sysfs_get_name_from_path(attr_path, devname, FILE_NAME_SIZE); + sysfs_close_directory(sdir); return 0; } } *************** *** 322,328 **** char * dst; char * p; int len; ! int free; if (!string) return NULL; --- 323,329 ---- char * dst; char * p; int len; ! int myfree; if (!string) return NULL; *************** *** 334,349 **** p = dst; pos = strchr(string, '%'); ! free = maxsize; ! if (!pos) ! return string; len = (int) (pos - string) + 1; ! free -= len; ! if (free < 2) return NULL; snprintf(p, len, "%s", string); p += len - 1; --- 335,354 ---- p = dst; pos = strchr(string, '%'); ! myfree = maxsize; ! if (!pos) { ! strcpy(dst, string); ! return dst; ! } len = (int) (pos - string) + 1; ! myfree -= len; ! if (myfree < 2) { ! free(dst); return NULL; + } snprintf(p, len, "%s", string); p += len - 1; *************** *** 352,371 **** switch (*pos) { case 'n': len = strlen(pp->dev) + 1; ! free -= len; ! if (free < 2) return NULL; snprintf(p, len, "%s", pp->dev); p += len - 1; break; case 'd': len = strlen(pp->dev_t) + 1; ! free -= len; ! if (free < 2) return NULL; snprintf(p, len, "%s", pp->dev_t); p += len - 1; --- 357,380 ---- switch (*pos) { case 'n': len = strlen(pp->dev) + 1; ! myfree -= len; ! if (myfree < 2) { ! free(dst); return NULL; + } snprintf(p, len, "%s", pp->dev); p += len - 1; break; case 'd': len = strlen(pp->dev_t) + 1; ! myfree -= len; ! if (myfree < 2) { ! free(dst); return NULL; + } snprintf(p, len, "%s", pp->dev_t); p += len - 1; *************** *** 379,388 **** return dst; len = strlen(pos) + 1; ! free -= len; ! if (free < 2) return NULL; snprintf(p, len, "%s", pos); dbg("reformated callout = %s", dst); --- 388,399 ---- return dst; len = strlen(pos) + 1; ! myfree -= len; ! if (myfree < 2) { ! free(dst); return NULL; + } snprintf(p, len, "%s", pos); dbg("reformated callout = %s", dst); *************** *** 429,434 **** --- 440,446 ---- else if (execute_program(buff, prio, 16)) { dbg("error calling out %s", buff); pp->priority = 1; + free(buff); } else pp->priority = atoi(prio); *************** *** 439,448 **** */ select_getuid(pp); buff = apply_format(pp->getuid, CALLOUT_MAX_SIZE, pp); ! ! if (buff && execute_program(buff, pp->wwid, WWID_SIZE) == 0) { ! dbg("uid = %s (callout)", pp->wwid); ! return 0; } /* --- 451,463 ---- */ select_getuid(pp); buff = apply_format(pp->getuid, CALLOUT_MAX_SIZE, pp); ! if (buff) { ! if (execute_program(buff, pp->wwid, WWID_SIZE) == 0) { ! free(buff); ! dbg("uid = %s (callout)", pp->wwid); ! return 0; ! } ! free(buff); } /*