/* * build_slot_path - build a path to an slot state file for this rom * * Note: uses rom.name. Is there a safer way of doing this? Like a ROM * checksum or something like that? */ static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) { char name_buf[17]; /* munge state file name */ strlcpy(name_buf, rom.name, sizeof(name_buf)); munge_name(name_buf, strlen(name_buf)); /* glom the whole mess together */ snprintf(buf, bufsiz, "%s/%s-%zud.rbs", STATE_DIR, name_buf, slot_id + 1); }
/* * build_slot_path - build a path to an slot state file for this rom * * Note: uses rom.name. Is there a safer way of doing this? Like a ROM * checksum or something like that? */ static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) { // char name_buf[40]; char *name_buf; name_buf=(char *)malloc(40); /* munge state file name */ strncpy(name_buf, rom.name,256); // sizeof(name_buf)); name_buf[16] = '\0'; munge_name(name_buf, strlen(name_buf)); /* glom the whole mess together */ snprintf(buf, bufsiz, "%s/%s-%d.avb", STATE_DIR, name_buf, slot_id + 1); free(name_buf); }