Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff -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); 12 13 #if(GLIBC_MINOR >= 1) 14 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"); 25 26*************** 27*** 3494,3499 **** 28--- 3498,3587 ---- 29 return result; 30 } 31 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; 38+ 39+ REFCOUNT; 40+ 41+ if (!libc_handle) 42+ initialize(); 43+ 44+ #if DEBUG 45+ debug(2,"getxattr(%s,%s)\n",pathname,name); 46+ #endif 47+ 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+ } 54+ 55+ instw_new(&instw); 56+ instw_setpath(&instw,pathname); 57+ instw_getstatus(&instw,&status); 58+ 59+ #if DEBUG 60+ instw_print(&instw); 61+ #endif 62+ 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+ } 68+ 69+ instw_delete(&instw); 70+ 71+ return result; 72+ } 73+ 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; 80+ 81+ REFCOUNT; 82+ 83+ if (!libc_handle) 84+ initialize(); 85+ 86+ #if DEBUG 87+ debug(2,"lgetxattr(%s,%s)\n",pathname,name); 88+ #endif 89+ 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+ } 96+ 97+ instw_new(&instw); 98+ instw_setpath(&instw,pathname); 99+ instw_getstatus(&instw,&status); 100+ 101+ #if DEBUG 102+ instw_print(&instw); 103+ #endif 104+ 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); 109+ } 110+ 111+ instw_delete(&instw); 112+ 113+ return result; 114+ } 115+ 116 #if(GLIBC_MINOR >= 1) 117 118 int creat64(const char *pathname, __mode_t mode) { 119*************** 120*** 3663,3668 **** 121--- 3751,3791 ---- 122 return result; 123 } 124 125+ int __open_2(const char *pathname, int flags, ...) { 126+ va_list ap; 127+ mode_t mode; 128+ 129+ #if DEBUG 130+ debug(2,"__open_2(%s,%d,mode)\n",pathname,flags); 131+ #endif 132+ 133+ va_start(ap, flags); 134+ mode = va_arg(ap, mode_t); 135+ va_end(ap); 136+ 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. */ 141+ 142+ return open(pathname,flags,mode); 143+ } 144+ 145+ int __open64_2(const char *pathname, int flags, ...) { 146+ va_list ap; 147+ mode_t mode; 148+ 149+ #if DEBUG 150+ debug(2,"__open64_2(%s,%d,mode)\n",pathname,flags); 151+ #endif 152+ 153+ va_start(ap, flags); 154+ mode = va_arg(ap, mode_t); 155+ va_end(ap); 156+ 157+ return open64(pathname,flags,mode); 158+ } 159+ 160 struct dirent64 *readdir64(DIR *dir) { 161 struct dirent64 *result; 162