[108149] trunk/base/src/darwintracelib1.0

cal at macports.org cal at macports.org
Sun Jul 14 04:28:56 PDT 2013


Revision: 108149
          https://trac.macports.org/changeset/108149
Author:   cal at macports.org
Date:     2013-07-14 04:28:56 -0700 (Sun, 14 Jul 2013)
Log Message:
-----------
darwintrace: fix build and warnings on Linux

Modified Paths:
--------------
    trunk/base/src/darwintracelib1.0/Makefile
    trunk/base/src/darwintracelib1.0/darwintrace.c

Modified: trunk/base/src/darwintracelib1.0/Makefile
===================================================================
--- trunk/base/src/darwintracelib1.0/Makefile	2013-07-14 11:08:37 UTC (rev 108148)
+++ trunk/base/src/darwintracelib1.0/Makefile	2013-07-14 11:28:56 UTC (rev 108149)
@@ -4,7 +4,7 @@
 
 include ../../Mk/macports.autoconf.mk
 
-CFLAGS+= -fPIC -Wno-deprecated-declarations -std=c99
+CFLAGS+= -fPIC -Wno-deprecated-declarations -std=c99 -D_XOPEN_SOURCE=500 -D_GNU_SOURCE
 CFLAGS_PEDANTIC=
 
 all:: ${SHLIB_NAME}

Modified: trunk/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-14 11:08:37 UTC (rev 108148)
+++ trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-14 11:28:56 UTC (rev 108149)
@@ -250,7 +250,7 @@
  * Convenience setter function for the thread-local darwintrace socket
  */
 static inline void __darwintrace_tid_set() {
-	if (0 != (errno = pthread_setspecific(tid_key, pthread_self()))) {
+	if (0 != (errno = pthread_setspecific(tid_key, (const void *) pthread_self()))) {
 		perror("darwintrace: pthread_setspecific");
 		abort();
 	}
@@ -597,9 +597,8 @@
 		}
 		sun.sun_family = AF_UNIX;
 		strlcpy(sun.sun_path, __env_darwintrace_log, sizeof(sun.sun_path));
-		sun.sun_len = SUN_LEN(&sun) + 1;
 
-		if (-1 == (connect(sock, (struct sockaddr *) &sun, sun.sun_len))) {
+		if (-1 == (connect(sock, (struct sockaddr *) &sun, sizeof(sun)))) {
 			perror("darwintrace: connect");
 			abort();
 		}
@@ -637,6 +636,9 @@
 				break;
 			}
 		}
+#		else
+		/* mark parameter as used */
+		(void)fd;
 #       endif
 
 		if (*path != '/') {
@@ -666,17 +668,17 @@
  * do a partial realpath(3) to fix "foo//bar" to "foo/bar"
  */
 static inline void __darwintrace_cleanup_path(char *path) {
+#   ifdef __APPLE__
 	size_t pathlen;
-#   ifdef __APPLE__
 	size_t rsrclen;
 #   endif
 	char *dst, *src;
 	enum { SAWSLASH, NOTHING } state = NOTHING;
 
+#   ifdef __APPLE__
+	/* ..namedfork/rsrc is only on OS X */
 	/* if this is a foo/..namedfork/rsrc, strip it off */
 	pathlen = strlen(path);
-	/* ..namedfork/rsrc is only on OS X */
-#   ifdef __APPLE__
 	rsrclen = strlen(_PATH_RSRCFORKSPEC);
 	if (pathlen > rsrclen && 0 == strcmp(path + pathlen - rsrclen, _PATH_RSRCFORKSPEC)) {
 		path[pathlen - rsrclen] = '\0';
@@ -1062,9 +1064,10 @@
 						break;
 					}
 				}
+
+				/* TODO check the iterpreter against the sandbox */
+				(void) interp;
 			}
-
-			/* TODO check the iterpreter against the sandbox */
 			close(fd);
 		}
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130714/1b4a8af7/attachment.html>


More information about the macports-changes mailing list