psss / rpms / libselinux

Forked from rpms/libselinux 5 years ago
Clone
0102138
diff --exclude-from=exclude -N -u -r nsalibselinux/src/avc_internal.c libselinux-2.0.34/src/avc_internal.c
0102138
--- nsalibselinux/src/avc_internal.c	2007-07-16 14:20:46.000000000 -0400
0102138
+++ libselinux-2.0.34/src/avc_internal.c	2007-09-24 11:37:47.000000000 -0400
0102138
@@ -61,7 +61,8 @@
0102138
 		rc = fd;
0102138
 		goto out;
0102138
 	}
0102138
-
0102138
+	
0102138
+	fcntl(fd, F_SETFD, FD_CLOEXEC);
0102138
 	if (!blocking && fcntl(fd, F_SETFL, O_NONBLOCK)) {
0102138
 		close(fd);
0102138
 		rc = -1;
ae054c5
diff --exclude-from=exclude -N -u -r nsalibselinux/src/Makefile libselinux-2.0.34/src/Makefile
ae054c5
--- nsalibselinux/src/Makefile	2007-08-03 16:02:56.000000000 -0400
ae054c5
+++ libselinux-2.0.34/src/Makefile	2007-09-24 11:51:42.000000000 -0400
ae054c5
@@ -57,10 +57,10 @@
ae054c5
 	$(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $<
ae054c5
 
ae054c5
 $(SWIGSO): $(SWIGLOBJ)
ae054c5
-	$(CC) $(LDFLAGS) -shared -o $@ $< -L. -lselinux -L$(LIBDIR) -Wl,-soname,$@
ae054c5
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lselinux -L$(LIBDIR) -Wl,-soname,$@
ae054c5
 
ae054c5
 $(LIBSO): $(LOBJS)
ae054c5
-	$(CC) $(LDFLAGS) -shared -o $@ $^ -ldl -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
ae054c5
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -ldl -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
ae054c5
 	ln -sf $@ $(TARGET) 
ae054c5
 
ae054c5
 %.o:  %.c policy.h
0102138
diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-2.0.34/src/matchpathcon.c
0fa749d
--- nsalibselinux/src/matchpathcon.c	2007-09-18 16:27:25.000000000 -0400
0102138
+++ libselinux-2.0.34/src/matchpathcon.c	2007-09-18 16:32:31.000000000 -0400
71cd138
@@ -2,6 +2,7 @@
71cd138
 #include <string.h>
71cd138
 #include <errno.h>
71cd138
 #include <stdio.h>
71cd138
+#include <syslog.h>
71cd138
 #include "selinux_internal.h"
71cd138
 #include "label_internal.h"
71cd138
 #include "callbacks.h"
0fa749d
@@ -57,7 +58,7 @@
71cd138
 {
71cd138
 	va_list ap;
71cd138
 	va_start(ap, fmt);
71cd138
-	vfprintf(stderr, fmt, ap);
0fa749d
+	vsyslog(LOG_ERR, fmt, ap);
71cd138
 	va_end(ap);
71cd138
 }
71cd138
 
0102138
diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselinux-2.0.34/utils/matchpathcon.c
0fa749d
--- nsalibselinux/utils/matchpathcon.c	2007-07-16 14:20:45.000000000 -0400
0102138
+++ libselinux-2.0.34/utils/matchpathcon.c	2007-09-18 16:32:31.000000000 -0400
0fa749d
@@ -17,10 +17,24 @@
0fa749d
 	exit(1);
0fa749d
 }
0fa749d
 
0fa749d
+static void
0fa749d
+#ifdef __GNUC__
0fa749d
+    __attribute__ ((format(printf, 1, 2)))
0fa749d
+#endif
0fa749d
+    myprintf(const char *fmt, ...)
0fa749d
+{
0fa749d
+	va_list ap;
0fa749d
+	va_start(ap, fmt);
0fa749d
+	vfprintf(stderr, fmt, ap);
0fa749d
+	va_end(ap);
0fa749d
+}
0fa749d
+
0fa749d
 int printmatchpathcon(char *path, int header, int mode)
0fa749d
 {
0fa749d
 	char *buf;
0fa749d
-	int rc = matchpathcon(path, mode, &buf;;
0fa749d
+	int rc;
0fa749d
+	set_matchpathcon_printf(myprintf);
0fa749d
+	rc = matchpathcon(path, mode, &buf;;
0fa749d
 	if (rc < 0) {
0fa749d
 		fprintf(stderr, "matchpathcon(%s) failed: %s\n", path,
0fa749d
 			strerror(errno));