The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / screen / 0002-no-memcpy-fallback.patch
1 From: Maarten ter Huurne <maarten@treewalker.org>
2 Date: Sat, 13 Sep 2014 11:37:59 +0200
3 Subject: Do not use memcpy as an alternative for bcopy/memmove
4
5 The configure script runs a small test program to check whether
6 memcpy can handle overlapping memory areas. However, it is not valid
7 to conclude that if a single case of overlapping memory is handled
8 correctly, all cases will be handled correctly.
9
10 Since screen already has its own bcopy implementation as a fallback
11 for the case that bcopy and memmove are unusable, removing the memcpy
12 option should not break any systems.
13
14 Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
15 ---
16  acconfig.h   |  3 +--
17  configure.in | 18 +-----------------
18  os.h         |  8 ++------
19  osdef.h.in   | 10 +---------
20  4 files changed, 5 insertions(+), 34 deletions(-)
21
22 diff --git a/acconfig.h b/acconfig.h
23 index 2e46985..9b0b9d4 100644
24 --- a/acconfig.h
25 +++ b/acconfig.h
26 @@ -476,7 +476,7 @@
27  #undef GETTTYENT
28  
29  /*
30 - * Define USEBCOPY if the bcopy/memcpy from your system's C library
31 + * Define USEBCOPY if the bcopy from your system's C library
32   * supports the overlapping of source and destination blocks.  When
33   * undefined, screen uses its own (probably slower) version of bcopy().
34   * 
35 @@ -487,7 +487,6 @@
36   * Their memove fails the test in the configure script. Sigh. (Juergen)
37   */
38  #undef USEBCOPY
39 -#undef USEMEMCPY
40  #undef USEMEMMOVE
41  
42  /*
43 diff --git a/configure.in b/configure.in
44 index 572c2a3..ff9606d 100644
45 --- a/configure.in
46 +++ b/configure.in
47 @@ -1144,7 +1144,7 @@ AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
48  AC_CHECKING(fdwalk)
49  AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
50  
51 -AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
52 +AC_CHECKING(whether memmove/bcopy handles overlapping arguments)
53  AC_TRY_RUN([
54  main() {
55    char buf[10];
56 @@ -1174,22 +1174,6 @@ main() {
57    exit(0); /* libc version works properly.  */
58  }], AC_DEFINE(USEMEMMOVE))
59  
60 -
61 -AC_TRY_RUN([
62 -#define bcopy(s,d,l) memcpy(d,s,l)
63 -main() {
64 -  char buf[10];
65 -  strcpy(buf, "abcdefghi");
66 -  bcopy(buf, buf + 2, 3);
67 -  if (strncmp(buf, "ababcf", 6))
68 -    exit(1);
69 -  strcpy(buf, "abcdefghi");
70 -  bcopy(buf + 2, buf, 3);
71 -  if (strncmp(buf, "cdedef", 6))
72 -    exit(1);
73 -  exit(0); /* libc version works properly.  */
74 -}], AC_DEFINE(USEMEMCPY))
75 -
76  AC_SYS_LONG_FILE_NAMES
77  
78  AC_MSG_CHECKING(for vsprintf)
79 diff --git a/os.h b/os.h
80 index 55de249..6838ec0 100644
81 --- a/os.h
82 +++ b/os.h
83 @@ -142,12 +142,8 @@ extern int errno;
84  # ifdef USEMEMMOVE
85  #  define bcopy(s,d,len) memmove(d,s,len)
86  # else
87 -#  ifdef USEMEMCPY
88 -#   define bcopy(s,d,len) memcpy(d,s,len)
89 -#  else
90 -#   define NEED_OWN_BCOPY
91 -#   define bcopy xbcopy
92 -#  endif
93 +#  define NEED_OWN_BCOPY
94 +#  define bcopy xbcopy
95  # endif
96  #endif
97  
98 diff --git a/osdef.h.in b/osdef.h.in
99 index 8687b60..e4057a0 100644
100 --- a/osdef.h.in
101 +++ b/osdef.h.in
102 @@ -58,16 +58,8 @@ extern int   bcmp __P((char *, char *, int));
103  extern int   killpg __P((int, int));
104  #endif
105  
106 -#ifndef USEBCOPY
107 -# ifdef USEMEMCPY
108 -extern void  memcpy __P((char *, char *, int));
109 -# else
110 -#  ifdef USEMEMMOVE
111 +#if defined(USEMEMMOVE) && !defined(USEBCOPY)
112  extern void  memmove __P((char *, char *, int));
113 -#  else
114 -extern void  bcopy __P((char *, char *, int));
115 -#  endif
116 -# endif
117  #else
118  extern void  bcopy __P((char *, char *, int));
119  #endif
120 -- 
121 1.8.4.5
122