0003-Fix-uClibc-build-issues.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. From 0554cfbb926a2ba26efda08865b270af8536e0bb Mon Sep 17 00:00:00 2001
  2. From: Simon Tatham <anakin@pobox.com>
  3. Date: Tue, 26 Mar 2019 20:03:09 +0200
  4. Subject: [PATCH] Fix uClibc build issues
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Fix two uClibc build failures.
  9. Missing sys/auxv.h header:
  10. ./../unix/uxutils.c:5:10: fatal error: sys/auxv.h: No such file or directory
  11. #include <sys/auxv.h>
  12. ^~~~~~~~~~~~
  13. Missing futimes() implementation:
  14. ./../unix/uxsftpserver.c: In function ‘uss_fsetstat’:
  15. ./../unix/uxsftpserver.c:441:25: warning: implicit declaration of function ‘futimes’; did you mean ‘lutimes’? [-Wimplicit-function-declaration]
  16. #define FD_PREFIX(func) f ## func
  17. ^
  18. ./../unix/uxsftpserver.c:435:17: note: in expansion of macro ‘FD_PREFIX’
  19. if (api_prefix(utimes)(api_arg, tv) < 0) \
  20. ^~~~~~~~~~
  21. ./../unix/uxsftpserver.c:470:5: note: in expansion of macro ‘SETSTAT_GUTS’
  22. SETSTAT_GUTS(FD_PREFIX, fd, attrs, success);
  23. ^~~~~~~~~~~~
  24. unix/uxsftpserver.o: In function `uss_fsetstat':
  25. uxsftpserver.c:(.text+0x1058): undefined reference to `futimes'
  26. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  27. ---
  28. Upstream status: patch suggested by upstream developer Simon Tatham
  29. configure.ac | 3 ++-
  30. unix/uxsftpserver.c | 10 ++++++++++
  31. unix/uxutils.c | 3 ++-
  32. 3 files changed, 14 insertions(+), 2 deletions(-)
  33. diff --git a/configure.ac b/configure.ac
  34. index 35552ed24dbe..1949ef62f219 100644
  35. --- a/configure.ac
  36. +++ b/configure.ac
  37. @@ -173,8 +173,9 @@ AC_CHECK_LIB(X11, XOpenDisplay,
  38. [GTK_LIBS="-lX11 $GTK_LIBS"
  39. AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
  40. -AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd])
  41. +AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd futimes])
  42. AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
  43. +AC_CHECK_HEADERS([sys/auxv.h asm/hwcap.h])
  44. AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
  45. AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [
  46. diff --git a/unix/uxsftpserver.c b/unix/uxsftpserver.c
  47. index 6fab0ba090d6..a90344e04219 100644
  48. --- a/unix/uxsftpserver.c
  49. +++ b/unix/uxsftpserver.c
  50. @@ -412,6 +412,16 @@ static void uss_fstat(SftpServer *srv, SftpReplyBuilder *reply,
  51. }
  52. }
  53. +#if !HAVE_FUTIMES
  54. +static inline int futimes(int fd, const struct timeval tv[2])
  55. +{
  56. + /* If the OS doesn't support futimes(3) then we have to pretend it
  57. + * always returns failure */
  58. + errno = EINVAL;
  59. + return -1;
  60. +}
  61. +#endif
  62. +
  63. /*
  64. * The guts of setstat and fsetstat, macroised so that they can call
  65. * fchown(fd,...) or chown(path,...) depending on parameters.
  66. diff --git a/unix/uxutils.c b/unix/uxutils.c
  67. index fcbcc4d422c1..f01bc2c14a2d 100644
  68. --- a/unix/uxutils.c
  69. +++ b/unix/uxutils.c
  70. @@ -1,6 +1,7 @@
  71. #include "ssh.h"
  72. -#if defined __linux__ && (defined __arm__ || defined __aarch64__)
  73. +#if defined __linux__ && (defined __arm__ || defined __aarch64__) && \
  74. + HAVE_SYS_AUXV_H && HAVE_ASM_HWCAP_H
  75. #include <sys/auxv.h>
  76. #include <asm/hwcap.h>
  77. --
  78. 2.20.1