We have strlen(3) and strndup(3) now.

Set NO_REGRESS while here.
This commit is contained in:
ajacoutot 2010-06-28 22:51:25 +00:00
parent 48b83a745c
commit ab3295d647
2 changed files with 5 additions and 22 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.2 2009/09/14 17:19:29 naddy Exp $
# $OpenBSD: Makefile,v 1.3 2010/06/28 22:51:25 ajacoutot Exp $
COMMENT = improved dynamic tiling window manager
DISTNAME = i3-3.c
PKGNAME = i3-3.3p0
PKGNAME = i3-3.3p1
CATEGORIES = x11
EXTRACT_SUFX = .tar.bz2
@ -27,6 +27,8 @@ RUN_DEPENDS = ::x11/dmenu
USE_GMAKE = Yes
USE_X11 = Yes
NO_REGRESS = Yes
pre-configure:
${SUBST_CMD} ${WRKSRC}/i3.config ${WRKSRC}/src/config.c

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-src_config_c,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
$OpenBSD: patch-src_config_c,v 1.2 2010/06/28 22:51:26 ajacoutot Exp $
--- src/config.c.orig Wed Aug 19 14:39:09 2009
+++ src/config.c Mon Aug 31 20:30:32 2009
@@ -226,8 +226,8 @@ void load_configuration(xcb_connection_t *conn, const
@ -12,22 +12,3 @@ $OpenBSD: patch-src_config_c,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
free(globbed);
}
char key[512], value[512], buffer[1026];
@@ -312,7 +312,17 @@ void load_configuration(xcb_connection_t *conn, const
rest++;
if (*rest != ' ')
die("Invalid binding (keysym)\n");
- new->symbol = strndup(sym, (rest - sym));
+#if defined(__OpenBSD__)
+ size_t len = strlen(sym);
+ if( len > (rest - sym))
+ len = (rest - sym);
+ new->symbol = malloc(len + 1);
+ memcpy(new->symbol,sym,len+1);
+ new->symbol[len]='\0';
+#else
+ new->symbol = strndup(sym, (rest - sym));
+#endif
+
}
rest++;
LOG("keycode = %d, symbol = %s, modifiers = %d, command = *%s*\n", new->keycode, new->symbol, modifiers, rest);