$OpenBSD: patch-source_rofi_c,v 1.7 2016/01/03 20:31:37 jasper Exp $

From b2bc07e51dbd2fd0f8455c73759ef5db8c2af746 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Sun, 3 Jan 2016 21:20:24 +0100
Subject: [PATCH] Fix a crash due to overlapping arguments of memcpy(3).

From 043a67d0624d4ff349e3146434677e837aa427e8 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Sun, 3 Jan 2016 20:49:13 +0100
Subject: [PATCH] Workaround lack of sigwaitinfo() on OpenBSD.

--- source/rofi.c.orig	Sun Dec 27 19:45:50 2015
+++ source/rofi.c	Sun Jan  3 21:19:08 2016
@@ -917,7 +917,7 @@ static void menu_refilter ( MenuState *state )
         g_mutex_clear ( &mutex );
         for ( unsigned int i = 0; i < nt; i++ ) {
             if ( j != states[i].start ) {
-                memcpy ( &( state->line_map[j] ), &( state->line_map[states[i].start] ), sizeof ( unsigned int ) * ( states[i].count ) );
+                memmove ( &( state->line_map[j] ), &( state->line_map[states[i].start] ), sizeof ( unsigned int ) * ( states[i].count ) );
             }
             j += states[i].count;
         }
@@ -2217,11 +2217,18 @@ static gpointer rofi_signal_handler_process ( gpointer
     sigaddset ( &set, SIGUSR1 );
     // loop forever.
     while ( 1 ) {
+#ifdef __OpenBSD__
+        int sig = 0;
+        if ( sigwait ( &set, &sig ) < 0 ) {
+            perror ( "sigwaitinfo failed, lets restart" );
+        }
+#else
         siginfo_t info;
         int       sig = sigwaitinfo ( &set, &info );
         if ( sig < 0 ) {
             perror ( "sigwaitinfo failed, lets restart" );
         }
+#endif
         else {
             // Send message to main thread.
             if ( sig == SIGHUP ) {
