From a0a5400c72e6af6b56b07b5a8b0f3c39a11daea7 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Thu, 24 Apr 2014 23:39:26 +0200 Subject: [PATCH] Fix bug with extra trailing \n --- source/run-dialog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/run-dialog.c b/source/run-dialog.c index 92b77343..8220a450 100644 --- a/source/run-dialog.c +++ b/source/run-dialog.c @@ -114,6 +114,7 @@ static pid_t exec_cmd ( const char *cmd, int run_in_term ) } retv = reallocate ( retv, ( index + 2 ) * sizeof ( element* ) ); retv[index] = allocate ( sizeof ( element ) ); + buffer[strlen ( buffer ) - 1] = '\0'; char * start = NULL; retv[index]->index = strtol ( buffer, &start, 10 ); snprintf ( retv[index]->name, RUN_DIALOG_NAME_LENGTH, "%s", start + 1 ); @@ -207,6 +208,7 @@ static void delete_entry ( const char *cmd ) } retv = reallocate ( retv, ( index + 2 ) * sizeof ( element* ) ); retv[index] = allocate ( sizeof ( element ) ); + buffer[strlen ( buffer ) - 1] = '\0'; retv[index]->index = strtol ( buffer, &start, 10 ); snprintf ( retv[index]->name, RUN_DIALOG_NAME_LENGTH, "%s", start + 1 ); retv[index + 1] = NULL;