From a22c81c4a9dd36f828b7e2fd870480782fdc7f61 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 18 Aug 2022 10:17:24 +0200 Subject: [PATCH] [DMenu] Strip off delimiter in sync mode. Fixes: #1679 --- source/modes/dmenu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/modes/dmenu.c b/source/modes/dmenu.c index 30f1b8ff..c0066099 100644 --- a/source/modes/dmenu.c +++ b/source/modes/dmenu.c @@ -237,6 +237,10 @@ static void read_input_sync(DmenuModePrivateData *pd, unsigned int pre_read) { char *line = NULL; while (pre_read > 0 && (nread = getdelim(&line, &len, pd->separator, pd->fd_file)) != -1) { + if (line[nread - 1] == pd->separator) { + nread--; + line[nread] = '\0'; + } read_add(pd, line, nread); pre_read--; }