patch-lib_utils_c 845 B

12345678910111213141516171819202122232425262728293031323334
  1. --- libnl-libnl3_2_29.orig/lib/utils.c 2016-12-30 15:57:01.000000000 +0100
  2. +++ libnl-libnl3_2_29/lib/utils.c 2017-04-26 20:09:18.137933191 +0200
  3. @@ -30,7 +30,9 @@
  4. #include <netlink/utils.h>
  5. #include <linux/socket.h>
  6. #include <stdlib.h> /* exit() */
  7. +#ifdef HAVE_STRERROR_L
  8. #include <locale.h>
  9. +#endif
  10. /**
  11. * Global variable indicating the desired level of debugging output.
  12. @@ -123,9 +125,10 @@ int __nl_read_num_str_file(const char *p
  13. const char *nl_strerror_l(int err)
  14. {
  15. + const char *buf;
  16. +#ifdef HAVE_STRERROR_L
  17. int errno_save = errno;
  18. locale_t loc = newlocale(LC_MESSAGES_MASK, "", (locale_t)0);
  19. - const char *buf;
  20. if (loc == (locale_t)0) {
  21. if (errno == ENOENT)
  22. @@ -140,6 +143,9 @@ const char *nl_strerror_l(int err)
  23. }
  24. errno = errno_save;
  25. +#else
  26. + buf = strerror(err);
  27. +#endif
  28. return buf;
  29. }
  30. /** @endcond */