locale.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Index: net-snmp-5.5/snmplib/parse.c
  2. ===================================================================
  3. --- net-snmp-5.5.orig/snmplib/parse.c
  4. +++ net-snmp-5.5/snmplib/parse.c
  5. @@ -101,6 +101,7 @@ SOFTWARE.
  6. #endif
  7. #include <errno.h>
  8. +#include <locale.h>
  9. #include <net-snmp/types.h>
  10. #include <net-snmp/output_api.h>
  11. @@ -4785,6 +4786,8 @@ add_mibdir(const char *dirname)
  12. char newline;
  13. struct stat dir_stat, idx_stat;
  14. char tmpstr1[300];
  15. + char *locale_data = setlocale(LC_CTYPE, "");
  16. + setlocale(LC_CTYPE, "C");
  17. #endif
  18. DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  19. @@ -4817,6 +4820,7 @@ add_mibdir(const char *dirname)
  20. count++;
  21. }
  22. fclose(ip);
  23. + setlocale(LC_CTYPE, locale_data);
  24. return count;
  25. } else
  26. DEBUGMSGTL(("parse-mibs", "Can't read index\n"));
  27. @@ -4858,11 +4862,13 @@ add_mibdir(const char *dirname)
  28. closedir(dir);
  29. if (ip)
  30. fclose(ip);
  31. + setlocale(LC_CTYPE, locale_data);
  32. return (count);
  33. }
  34. else
  35. DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  36. + setlocale(LC_CTYPE, locale_data);
  37. return (-1);
  38. }