apcupsd-3.14.9-aliasing.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Index: apcupsd-3.14.9/src/apctest.c
  2. ===================================================================
  3. --- apcupsd-3.14.9.orig/src/apctest.c
  4. +++ apcupsd-3.14.9/src/apctest.c
  5. @@ -2206,18 +2206,18 @@ static struct {
  6. const char *config_directive;
  7. const char *descript;
  8. char type;
  9. - int *data;
  10. + void *data;
  11. } cmd_table[] = {
  12. {'u', "HITRANSFER", "Upper transfer voltage", 'i', &eeprom_ups.hitrans},
  13. {'l', "LOTRANSFER", "Lower transfer voltage", 'i', &eeprom_ups.lotrans},
  14. {'e', "RETURNCHARGE", "Return threshold", 'i', &eeprom_ups.rtnpct},
  15. {'o', "OUTPUTVOLTS", "Output voltage on batts", 'i', &eeprom_ups.NomOutputVoltage},
  16. - {'s', "SENSITIVITY", "Sensitivity", 'c', (int *)eeprom_ups.sensitivity},
  17. + {'s', "SENSITIVITY", "Sensitivity", 'c', eeprom_ups.sensitivity},
  18. {'q', "LOWBATT", "Low battery warning", 'i', &eeprom_ups.dlowbatt},
  19. {'p', "SLEEP", "Shutdown grace delay", 'i', &eeprom_ups.dshutd},
  20. - {'k', "BEEPSTATE", "Alarm delay", 'c', (int *)eeprom_ups.beepstate},
  21. + {'k', "BEEPSTATE", "Alarm delay", 'c', eeprom_ups.beepstate},
  22. {'r', "WAKEUP", "Wakeup delay", 'i', &eeprom_ups.dwake},
  23. - {'E', "SELFTEST", "Self test interval", 'c', (int *)eeprom_ups.selftest},
  24. + {'E', "SELFTEST", "Self test interval", 'c', eeprom_ups.selftest},
  25. {0, NULL, NULL} /* Last entry */
  26. };
  27. @@ -2240,9 +2240,9 @@ static void print_valid_eeprom_values(UP
  28. for (j = 0; cmd_table[j].cmd; j++) {
  29. if (cmd[i].cmd == cmd_table[j].cmd) {
  30. if (cmd_table[j].type == 'c')
  31. - asnprintf(val, sizeof(val), "%s", (char *)cmd_table[j].data);
  32. + asnprintf(val, sizeof(val), "%s", cmd_table[j].data);
  33. else
  34. - asnprintf(val, sizeof(val), "%d", *cmd_table[j].data);
  35. + asnprintf(val, sizeof(val), "%d", *((int*)cmd_table[j].data));
  36. pmsg("%-24s %-12s %-6s ", cmd_table[j].descript,
  37. cmd_table[j].config_directive, val);