patch-environ_c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. $OpenBSD: patch-environ_c,v 1.2 2011/11/04 10:00:19 jasper Exp $
  2. --- environ.c.orig Mon Sep 29 12:00:24 1997
  3. +++ environ.c Fri Nov 4 10:57:45 2011
  4. @@ -40,11 +40,14 @@
  5. #define SUBS_DEFINED
  6. +#include <stdlib.h>
  7. #include <string.h>
  8. #include <dos.h>
  9. #include <io.h>
  10. #include <fcntl.h>
  11. #include <alloc.h>
  12. +#include <sys/types.h>
  13. +#include <utime.h>
  14. FILE *
  15. file_open(name, mode)
  16. @@ -432,14 +435,17 @@ uint host;
  17. #include <time.h>
  18. +#if !(defined(__OpenBSD__))
  19. #ifndef time_t
  20. #define time_t long
  21. #endif
  22. +#endif
  23. +#if !(defined(BSD) && BSD >= 199306)
  24. extern struct tm *localtime();
  25. -extern time_t time();
  26. extern char *strcpy();
  27. extern voidp *malloc();
  28. +#endif
  29. FILE *
  30. file_open(name, mode)
  31. @@ -535,8 +541,12 @@ uint mode;
  32. }
  33. long
  34. -gettz() /* returns the offset from GMT in seconds */
  35. +gettz(stamp) /* returns the offset from GMT in seconds */
  36. +time_t stamp;
  37. {
  38. +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
  39. + return -localtime(&stamp)->tm_gmtoff;
  40. +#else
  41. #define NOONOFFSET 43200L
  42. #define SEC_IN_DAY (24L * 60L * 60L)
  43. #define INV_VALUE (SEC_IN_DAY + 1L)
  44. @@ -552,6 +562,7 @@ gettz() /* returns the offset from GMT in seco
  45. noontm = localtime(&noon);
  46. retval = NOONOFFSET - 60 * (60 * noontm->tm_hour - noontm->tm_min);
  47. return retval;
  48. +#endif
  49. }
  50. long
  51. @@ -609,7 +620,8 @@ uint host;
  52. (uint) attribute;
  53. (uint) host;
  54. - m_time = mstonix(tstamp) + gettz();
  55. + m_time = mstonix(tstamp);
  56. + m_time += gettz(m_time);
  57. tb.mtime = m_time; /* Set modification time */
  58. tb.atime = m_time; /* Set access time */