View | Details | Raw Unified | Return to bug 212261
Collapse All | Expand All

(-)Makefile (-14 / +13 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	xsel
4
PORTNAME=	xsel
5
PORTVERSION=	1.2.0
5
PORTVERSION=	1.2.0
6
PORTREVISION=	1
6
CATEGORIES=	x11
7
CATEGORIES=	x11
7
MASTER_SITES=	http://www.vergenet.net/~conrad/software/xsel/download/
8
MASTER_SITES=	http://www.vergenet.net/~conrad/software/xsel/download/
8
PKGNAMESUFFIX=	-conrad
9
PKGNAMESUFFIX=	-conrad
Lines 17-40 Link Here
17
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
18
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
18
19
19
CONFLICTS_INSTALL=	xsel-[0-9]*
20
CONFLICTS_INSTALL=	xsel-[0-9]*
20
USE_XORG=	x11 xext xt xproto ice sm
21
21
CFLAGS+=	-I${LOCALBASE}/include
22
USES=	autoreconf localbase
22
LDFLAGS+=	-L${LOCALBASE}/lib -lXext -lX11
23
USE_XORG=	x11 xt
23
PLIST_FILES=	bin/${PORTNAME} man/man1/${PORTNAME}.1.gz
24
PORTDOCS=	ChangeLog README
25
GNU_CONFIGURE=	yes
24
GNU_CONFIGURE=	yes
26
25
26
PLIST_FILES=	bin/${PORTNAME} \
27
		man/man1/${PORTNAME}.1.gz
28
29
PORTDOCS=	ChangeLog README
30
27
OPTIONS_DEFINE=	DOCS
31
OPTIONS_DEFINE=	DOCS
28
32
29
post-patch:
30
	@${REINPLACE_CMD} -e 's|jmp_buf|sigjmp_buf|g' ${WRKSRC}/xsel.c
31
	@${REINPLACE_CMD} -e 's|@X_CFLAGS@|${CFLAGS}|;\
32
		s|@X_LIBS@|${LDFLAGS}|' ${WRKSRC}/Makefile.in
33
34
do-install:
33
do-install:
35
	@${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
34
	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
36
	@${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1x ${STAGEDIR}${MAN1PREFIX}/man/man1/${PORTNAME}.1
35
	${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1x ${STAGEDIR}${MAN1PREFIX}/man/man1/${PORTNAME}.1
37
	@${INSTALL} -d ${STAGEDIR}${DOCSDIR}/
36
	@${MKDIR} ${STAGEDIR}${DOCSDIR}/
38
	@cd ${WRKSRC}/&&${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}/
37
	@cd ${WRKSRC}/ && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}/
39
38
40
.include <bsd.port.mk>
39
.include <bsd.port.mk>
(-)files/patch-xsel.c (+61 lines)
Line 0 Link Here
1
$OpenBSD: patch-xsel_c,v 1.2 2014/07/07 08:25:16 sthen Exp $
2
3
- Format "32" properties use "long", not "int", even on LP64 platforms.
4
- ensure NUM_TARGETS does not exceed MAX_NUM_TARGETS.
5
- plug a memory leak in handle_targets()
6
7
--- xsel.c.orig	2008-02-12 04:50:18 UTC
8
+++ xsel.c
9
@@ -15,6 +15,7 @@
10
 #include "config.h"
11
 #endif
12
 
13
+#include <assert.h>
14
 #include <stdio.h>
15
 #include <stdlib.h>
16
 #include <stdarg.h>
17
@@ -465,7 +466,7 @@ get_timestamp (void)
18
  */
19
 
20
 /* The jmp_buf to longjmp out of the signal handler */
21
-static jmp_buf env_alrm;
22
+static sigjmp_buf env_alrm;
23
 
24
 /*
25
  * alarm_handler (sig)
26
@@ -1300,14 +1301,16 @@ handle_targets (Display * display, Windo
27
                 Atom selection, Time time, MultTrack * mparent)
28
 {
29
   Atom * targets_cpy;
30
+  HandleResult r;
31
 
32
   targets_cpy = malloc (sizeof (supported_targets));
33
   memcpy (targets_cpy, supported_targets, sizeof (supported_targets));
34
 
35
-  return
36
-    change_property (display, requestor, property, XA_ATOM, 32,
37
+  r = change_property (display, requestor, property, XA_ATOM, 32,
38
                      PropModeReplace, (unsigned char *)targets_cpy,
39
                      NUM_TARGETS, selection, time, mparent);
40
+  free(targets_cpy);
41
+  return r;
42
 }
43
 
44
 /*
45
@@ -2078,7 +2081,6 @@ main(int argc, char *argv[])
46
 
47
   /* Get the NULL atom */
48
   null_atom = XInternAtom (display, "NULL", False);
49
-  NUM_TARGETS++;
50
 
51
   /* Get the TEXT atom */
52
   text_atom = XInternAtom (display, "TEXT", False);
53
@@ -2097,6 +2099,8 @@ main(int argc, char *argv[])
54
   supported_targets[s++] = XA_STRING;
55
   NUM_TARGETS++;
56
 
57
+  assert(NUM_TARGETS <= MAX_NUM_TARGETS);
58
+
59
   /* Get the COMPOUND_TEXT atom.
60
    * NB. We do not currently serve COMPOUND_TEXT; we can retrieve it but
61
    * do not perform charset conversion.

Return to bug 212261