Ticket #22716: macports.patch
File macports.patch, 2.3 KB (added by mmpestorich (Mike M Pestorich), 15 years ago) |
---|
-
src/macports1.0/sysctl.c
41 41 #include <sys/types.h> 42 42 #include <sys/sysctl.h> 43 43 44 #include <sys/cdefs.h> 45 44 46 #include "sysctl.h" 45 47 46 48 /* 49 * Work around for linux 50 */ 51 int 52 sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) 53 { 54 int name2oid_oid[2]; 55 int real_oid[CTL_MAXNAME+2]; 56 int error; 57 size_t oidlen; 58 59 name2oid_oid[0] = 0; /* This is magic & undocumented! */ 60 name2oid_oid[1] = 3; 61 62 oidlen = sizeof(real_oid); 63 error = sysctl(name2oid_oid, 2, real_oid, &oidlen, (void *)name, 64 strlen(name)); 65 if (error < 0) 66 return error; 67 oidlen /= sizeof (int); 68 error = sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen); 69 return (error); 70 } 71 72 /* 47 73 * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT and CTLTYPE_QUAD. 48 74 */ 49 75 int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -
src/pextlib1.0/tracelib.c
46 46 #include <pthread.h> 47 47 #include <limits.h> 48 48 #include "tracelib.h" 49 #include <sys/cdefs.h> 49 50 50 51 static char * name; 51 52 static char * sandbox; … … 73 74 74 75 #define MAX_SOCKETS ((FD_SETSIZE)-1) 75 76 77 /* 78 * Copy src to string dst of size siz. At most siz-1 characters 79 * will be copied. Always NUL terminates (unless siz == 0). 80 * Returns strlen(src); if retval >= siz, truncation occurred. 81 */ 82 size_t strlcpy(dst, src, siz) 83 char *dst; 84 const char *src; 85 size_t siz; 86 { 87 char *d = dst; 88 const char *s = src; 89 size_t n = siz; 90 91 /* Copy as many bytes as will fit */ 92 if (n != 0 && --n != 0) { 93 do { 94 if ((*d++ = *s++) == 0) 95 break; 96 } while (--n != 0); 97 } 98 99 /* Not enough room in dst, add NUL and traverse rest of src */ 100 if (n == 0) { 101 if (siz != 0) 102 *d = '\0';/* NUL-terminate dst */ 103 while (*s++) 104 ; 105 } 106 107 return(s - src - 1);/* count does not include NUL */ 108 } 109 76 110 static int TracelibSetNameCmd(Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[]) 77 111 { 78 112 if (objc != 3)