summaryrefslogtreecommitdiffstats
path: root/package/putty/0003-Fix-uClibc-build-issues.patch
blob: ceefded9767eb521b2e61e84ca1bc1637f609d59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
From 0554cfbb926a2ba26efda08865b270af8536e0bb Mon Sep 17 00:00:00 2001
From: Simon Tatham <anakin@pobox.com>
Date: Tue, 26 Mar 2019 20:03:09 +0200
Subject: [PATCH] Fix uClibc build issues
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix two uClibc build failures.

Missing sys/auxv.h header:

./../unix/uxutils.c:5:10: fatal error: sys/auxv.h: No such file or directory
 #include <sys/auxv.h>
          ^~~~~~~~~~~~

Missing futimes() implementation:

./../unix/uxsftpserver.c: In function ‘uss_fsetstat’:
./../unix/uxsftpserver.c:441:25: warning: implicit declaration of function ‘futimes’; did you mean ‘lutimes’? [-Wimplicit-function-declaration]
 #define FD_PREFIX(func) f ## func
                         ^
./../unix/uxsftpserver.c:435:17: note: in expansion of macro ‘FD_PREFIX’
             if (api_prefix(utimes)(api_arg, tv) < 0)                    \
                 ^~~~~~~~~~
./../unix/uxsftpserver.c:470:5: note: in expansion of macro ‘SETSTAT_GUTS’
     SETSTAT_GUTS(FD_PREFIX, fd, attrs, success);
     ^~~~~~~~~~~~

unix/uxsftpserver.o: In function `uss_fsetstat':
uxsftpserver.c:(.text+0x1058): undefined reference to `futimes'

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Upstream status: patch suggested by upstream developer Simon Tatham

 configure.ac        |  3 ++-
 unix/uxsftpserver.c | 10 ++++++++++
 unix/uxutils.c      |  3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 35552ed24dbe..1949ef62f219 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,8 +173,9 @@ AC_CHECK_LIB(X11, XOpenDisplay,
              [GTK_LIBS="-lX11 $GTK_LIBS"
               AC_DEFINE([HAVE_LIBX11],[],[Define if libX11.a is available])])
 
-AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd])
+AC_CHECK_FUNCS([getaddrinfo posix_openpt ptsname setresuid strsignal updwtmpx fstatat dirfd futimes])
 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
+AC_CHECK_HEADERS([sys/auxv.h asm/hwcap.h])
 AC_SEARCH_LIBS([clock_gettime], [rt], [AC_DEFINE([HAVE_CLOCK_GETTIME],[],[Define if clock_gettime() is available])])
 
 AC_CACHE_CHECK([for SO_PEERCRED and dependencies], [x_cv_linux_so_peercred], [
diff --git a/unix/uxsftpserver.c b/unix/uxsftpserver.c
index 6fab0ba090d6..a90344e04219 100644
--- a/unix/uxsftpserver.c
+++ b/unix/uxsftpserver.c
@@ -412,6 +412,16 @@ static void uss_fstat(SftpServer *srv, SftpReplyBuilder *reply,
     }
 }
 
+#if !HAVE_FUTIMES
+static inline int futimes(int fd, const struct timeval tv[2])
+{
+    /* If the OS doesn't support futimes(3) then we have to pretend it
+     * always returns failure */
+    errno = EINVAL;
+    return -1;
+}
+#endif
+
 /*
  * The guts of setstat and fsetstat, macroised so that they can call
  * fchown(fd,...) or chown(path,...) depending on parameters.
diff --git a/unix/uxutils.c b/unix/uxutils.c
index fcbcc4d422c1..f01bc2c14a2d 100644
--- a/unix/uxutils.c
+++ b/unix/uxutils.c
@@ -1,6 +1,7 @@
 #include "ssh.h"
 
-#if defined __linux__ && (defined __arm__ || defined __aarch64__)
+#if defined __linux__ && (defined __arm__ || defined __aarch64__) && \
+    HAVE_SYS_AUXV_H && HAVE_ASM_HWCAP_H
 
 #include <sys/auxv.h>
 #include <asm/hwcap.h>
-- 
2.20.1

OpenPOWER on IntegriCloud