Mercurial > trustbridge
changeset 291:5ab445e6a4da
Trim instruction lines to avoid line ending trouble
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 15:35:12 +0000 |
parents | b460d2cf088d |
children | 57867a523dcf |
files | cinst/main.c |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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; } }