Merge pull request #312731 from fabaff/hickle-refactor
[NixPkgs.git] / pkgs / tools / package-management / checkinstall / missing-functions.patch
blob02066134b2edfed3b54962e384ae96c63c27cef9
1 diff -rc checkinstall-orig/installwatch/installwatch.c checkinstall/installwatch/installwatch.c
2 *** checkinstall-orig/installwatch/installwatch.c 2009-03-12 13:40:24.000000000 +0100
3 --- checkinstall/installwatch/installwatch.c 2009-03-27 22:42:19.000000000 +0100
4 ***************
5 *** 110,115 ****
6 --- 110,117 ----
7 static int (*true_setxattr)(const char *,const char *,const void *,
8 size_t, int);
9 static int (*true_removexattr)(const char *,const char *);
10 + static ssize_t (*true_getxattr)(const char *,const char *,const void *,size_t);
11 + static ssize_t (*true_lgetxattr)(const char *,const char *,const void *,size_t);
13 #if(GLIBC_MINOR >= 1)
15 ***************
16 *** 369,374 ****
17 --- 371,378 ----
18 true_unlink = dlsym(libc_handle, "unlink");
19 true_utime = dlsym(libc_handle, "utime");
20 true_setxattr = dlsym(libc_handle, "setxattr");
21 + true_getxattr = dlsym(libc_handle, "getxattr");
22 + true_lgetxattr = dlsym(libc_handle, "lgetxattr");
23 true_utimes = dlsym(libc_handle, "utimes");
24 true_access = dlsym(libc_handle, "access");
26 ***************
27 *** 3494,3499 ****
28 --- 3498,3587 ----
29 return result;
32 + int getxattr (const char *pathname, const char *name,
33 + const void *value, size_t size)
34 + {
35 + int result;
36 + instw_t instw;
37 + int status;
39 + REFCOUNT;
41 + if (!libc_handle)
42 + initialize();
44 + #if DEBUG
45 + debug(2,"getxattr(%s,%s)\n",pathname,name);
46 + #endif
48 + /* We were asked to work in "real" mode */
49 + if( !(__instw.gstatus & INSTW_INITIALIZED) ||
50 + !(__instw.gstatus & INSTW_OKWRAP) ) {
51 + result=true_getxattr(pathname,name,value,size);
52 + return result;
53 + }
55 + instw_new(&instw);
56 + instw_setpath(&instw,pathname);
57 + instw_getstatus(&instw,&status);
59 + #if DEBUG
60 + instw_print(&instw);
61 + #endif
63 + if(status&INSTW_TRANSLATED) {
64 + result=true_getxattr(instw.translpath,name,value,size);
65 + } else {
66 + result=true_getxattr(instw.path,name,value,size);
67 + }
69 + instw_delete(&instw);
71 + return result;
72 + }
74 + int lgetxattr (const char *pathname, const char *name,
75 + const void *value, size_t size)
76 + {
77 + int result;
78 + instw_t instw;
79 + int status;
81 + REFCOUNT;
83 + if (!libc_handle)
84 + initialize();
86 + #if DEBUG
87 + debug(2,"lgetxattr(%s,%s)\n",pathname,name);
88 + #endif
90 + /* We were asked to work in "real" mode */
91 + if( !(__instw.gstatus & INSTW_INITIALIZED) ||
92 + !(__instw.gstatus & INSTW_OKWRAP) ) {
93 + result=true_lgetxattr(pathname,name,value,size);
94 + return result;
95 + }
97 + instw_new(&instw);
98 + instw_setpath(&instw,pathname);
99 + instw_getstatus(&instw,&status);
101 + #if DEBUG
102 + instw_print(&instw);
103 + #endif
105 + if(status&INSTW_TRANSLATED) {
106 + result=true_lgetxattr(instw.translpath,name,value,size);
107 + } else {
108 + result=true_lgetxattr(instw.path,name,value,size);
111 + instw_delete(&instw);
113 + return result;
116 #if(GLIBC_MINOR >= 1)
118 int creat64(const char *pathname, __mode_t mode) {
119 ***************
120 *** 3663,3668 ****
121 --- 3751,3791 ----
122 return result;
125 + int __open_2(const char *pathname, int flags, ...) {
126 + va_list ap;
127 + mode_t mode;
129 + #if DEBUG
130 + debug(2,"__open_2(%s,%d,mode)\n",pathname,flags);
131 + #endif
133 + va_start(ap, flags);
134 + mode = va_arg(ap, mode_t);
135 + va_end(ap);
137 + /* The open() function in Glibc 2.9 is an always-inline
138 + function that may call __open_2(), so it's important that
139 + we handle it. I don't know what __open_2() is supposed to
140 + do, but redirecting it to open() seems to work fine. */
142 + return open(pathname,flags,mode);
145 + int __open64_2(const char *pathname, int flags, ...) {
146 + va_list ap;
147 + mode_t mode;
149 + #if DEBUG
150 + debug(2,"__open64_2(%s,%d,mode)\n",pathname,flags);
151 + #endif
153 + va_start(ap, flags);
154 + mode = va_arg(ap, mode_t);
155 + va_end(ap);
157 + return open64(pathname,flags,mode);
160 struct dirent64 *readdir64(DIR *dir) {
161 struct dirent64 *result;