summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorQball Cow <qball@gmpclient.org>2014-04-24 23:39:26 +0200
committerQball Cow <qball@gmpclient.org>2014-04-24 23:39:26 +0200
commita0a5400c72e6af6b56b07b5a8b0f3c39a11daea7 (patch)
treed771b5e2fea1ebed007640c77ebe629705b4d670 /source
parentaeefabe7a07cb7eae135dac7296bf93c16888239 (diff)
Fix bug with extra trailing \n
Diffstat (limited to 'source')
-rw-r--r--source/run-dialog.c2
1 files changed, 2 insertions, 0 deletions
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;