# HG changeset patch # User Andre Heinecke # Date 1396452912 0 # Node ID 5ab445e6a4da0790478bbb99dcf140bb483af5cb # Parent b460d2cf088d041dd75669556f94c460c6b49a7a Trim instruction lines to avoid line ending trouble diff -r b460d2cf088d -r 5ab445e6a4da cinst/main.c --- a/cinst/main.c Wed Apr 02 14:12:37 2014 +0000 +++ b/cinst/main.c Wed Apr 02 15:35:12 2014 +0000 @@ -115,14 +115,18 @@ } if (*buf == 'I') { - /* Remove leading I: and trailing \n */ - strv_append (to_install, buf + 2, len - 3); + char *trimmed = buf+2; + /* Remove leading I: and trailing whitespace */ + str_trim(&trimmed); + strv_append (to_install, trimmed, strlen(trimmed)); continue; } if (*buf == 'R') { - /* Remove leading R: and trailing \n */ - strv_append (to_remove, buf + 2, len - 3); + char *trimmed = buf+2; + /* Remove leading R: and trailing whitespace */ + str_trim(&trimmed); + strv_append (to_remove, trimmed, strlen(trimmed)); continue; } } @@ -162,7 +166,7 @@ bool found = false; for (j = 0; all_certs[j]; j++) { - if (strncmp (to_validate[i], all_certs[j], MAX_LINE_LENGTH - 2) == + if (strncmp (to_validate[i], all_certs[j], MAX_LINE_LENGTH) == 0) { found = true; @@ -171,7 +175,7 @@ } if (!found) { - printf ("Install instruction with invalid certificate\n."); + DEBUGPRINTF ("Failed to find certificate; \n%s\n", to_validate[i]); return ERR_INVALID_INSTRUCTIONS; } }