0001-programs-util.c-fix-build-without-st_mtime.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 26d01bdb26f1c7487ad4ba0151221dfe28cd878d Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 15 Jul 2020 21:19:14 +0200
  4. Subject: [PATCH] programs/util.c: fix build without st_mtime
  5. Since version 1.4.5 and commit
  6. 5af8cb7aea8d890b4801e50e5274371510f2cf33, if st_mtime is not defined,
  7. programs/util.c uses utime without including utime.h which will raise
  8. the following build failure on some of the buildroot autobuilders:
  9. util.c: In function 'UTIL_setFileStat':
  10. util.c:161:24: error: storage size of 'timebuf' isn't known
  11. struct utimbuf timebuf;
  12. ^~~~~~~
  13. Fixes:
  14. - http://autobuild.buildroot.org/results/be902c5d110f37bce622a2215191f155b7d3e7e0
  15. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  16. [Upstream status: https://github.com/facebook/zstd/pull/2246]
  17. ---
  18. programs/util.c | 2 +-
  19. 1 file changed, 1 insertion(+), 1 deletion(-)
  20. diff --git a/programs/util.c b/programs/util.c
  21. index a0d45745..2493a4ad 100644
  22. --- a/programs/util.c
  23. +++ b/programs/util.c
  24. @@ -28,7 +28,7 @@ extern "C" {
  25. # include <io.h> /* _chmod */
  26. #else
  27. # include <unistd.h> /* chown, stat */
  28. -# if PLATFORM_POSIX_VERSION < 200809L
  29. +# if PLATFORM_POSIX_VERSION < 200809L || !defined(st_mtime)
  30. # include <utime.h> /* utime */
  31. # else
  32. # include <fcntl.h> /* AT_FDCWD */
  33. --
  34. 2.27.0