0009-BUILD-lua-replace-timegm-with-my_timegm-to-fix-build.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From df1655a6c0e4431317cc66c67693281092a952b0 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Wed, 19 Jul 2017 19:08:48 +0200
  4. Subject: [PATCH 09/18] BUILD: lua: replace timegm() with my_timegm() to fix
  5. build on Solaris 10
  6. Akhnin Nikita reported that Lua doesn't build on Solaris 10 because
  7. the code uses timegm() to parse a date, which is not provided there.
  8. The recommended way to implement timegm() is broken in the man page,
  9. as it is based on a change of the TZ environment variable at run time
  10. before calling the function (which is obviously not thread safe, and
  11. terribly inefficient).
  12. Here instead we rely on the new my_timegm() function, it should be
  13. sufficient for all known use cases.
  14. (cherry picked from commit abd9bb20b76818c9f461a82b72b10818736ff8b3)
  15. Signed-off-by: Willy Tarreau <w@1wt.eu>
  16. ---
  17. src/hlua_fcn.c | 2 +-
  18. 1 file changed, 1 insertion(+), 1 deletion(-)
  19. diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
  20. index 58905d7d..fe899a4a 100644
  21. --- a/src/hlua_fcn.c
  22. +++ b/src/hlua_fcn.c
  23. @@ -287,7 +287,7 @@ static int hlua_parse_date(lua_State *L, int (*fcn)(const char *, int, struct tm
  24. * the timezone from the broken-down time, it must be fixed
  25. * after the conversion.
  26. */
  27. - time = timegm(&tm);
  28. + time = my_timegm(&tm);
  29. if (time == -1) {
  30. lua_pushnil(L);
  31. return 1;
  32. --
  33. 2.13.0