added missing newlines to error messages

This commit is contained in:
git@daemon.de
2014-05-05 12:01:55 +02:00
parent 7ae0cedcb1
commit 64eb4651f8
6 changed files with 20 additions and 18 deletions

View File

@@ -30,14 +30,14 @@ char *pcp_getstdin(const char *prompt) {
fprintf(stderr, "%s: ", prompt);
if (fgets(line, 255, stdin) == NULL) {
fatal(ptx, "Cannot read from stdin");
fatal(ptx, "Cannot read from stdin\n");
goto errgst;
}
line[strcspn(line, "\r\n")] = '\0';
if ((out = strdup(line)) == NULL) {
fatal(ptx, "Cannot allocate memory");
fatal(ptx, "Cannot allocate memory\n");
goto errgst;
}
@@ -222,7 +222,7 @@ void pcp_exportsecret(char *keyid, int useid, char *outfile, int armor, char *pa
}
else {
if((out = fopen(outfile, "wb+")) == NULL) {
fatal(ptx, "Could not create output file %s", outfile);
fatal(ptx, "Could not create output file %s\n", outfile);
goto errexpse1;
}
}
@@ -307,7 +307,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int
}
else {
if((out = fopen(outfile, "wb+")) == NULL) {
fatal(ptx, "Could not create output file %s", outfile);
fatal(ptx, "Could not create output file %s\n", outfile);
goto errpcpexpu1;
}
}
@@ -381,7 +381,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int
}
else {
/* FIXME: export foreign keys unsupported yet */
fatal(ptx, "Exporting foreign public keys in native format unsupported yet");
fatal(ptx, "Exporting foreign public keys in native format unsupported yet\n");
goto errpcpexpu1;
}
}
@@ -399,7 +399,7 @@ void pcp_exportpublic(char *keyid, char *passwd, char *outfile, int format, int
}
}
else {
fatal(ptx, "Exporting foreign public keys in PBP format not possible");
fatal(ptx, "Exporting foreign public keys in PBP format not possible\n");
goto errpcpexpu1;
}
}
@@ -615,6 +615,8 @@ int pcp_import (vault_t *vault, FILE *in, char *passwd) {
}
else {
/* it's not public key, so let's try to interpret it as secret key */
if(ptx->verbose)
fatals_ifany(ptx);
if(passwd != NULL) {
sk = pcp_import_secret(ptx, buf, bufsize, passwd);
}

View File

@@ -305,7 +305,7 @@ void pcpexport_yaml(char *outfile) {
}
else {
if((out = fopen(outfile, "wb+")) == NULL) {
fatal(ptx, "Could not create output file %s", outfile);
fatal(ptx, "Could not create output file %s\n", outfile);
out = NULL;
}
}

View File

@@ -58,13 +58,13 @@ pcp_readpass(char ** passwd, const char * prompt,
/* If we're reading from a terminal, try to disable echo. */
if ((usingtty = isatty(fileno(readfrom))) != 0) {
if (tcgetattr(fileno(readfrom), &term_old)) {
fatal(ptx, "Cannot read terminal settings");
fatal(ptx, "Cannot read terminal settings\n");
goto err1;
}
memcpy(&term, &term_old, sizeof(struct termios));
term.c_lflag = (term.c_lflag & ~ECHO) | ECHONL;
if (tcsetattr(fileno(readfrom), TCSANOW, &term)) {
fatal(ptx, "Cannot set terminal settings");
fatal(ptx, "Cannot set terminal settings\n");
goto err1;
}
}
@@ -76,7 +76,7 @@ retry:
/* Read the password. */
if (fgets(passbuf, MAXPASSLEN, readfrom) == NULL) {
fatal(ptx, "Cannot read password");
fatal(ptx, "Cannot read password\n");
goto err2;
}
@@ -85,7 +85,7 @@ retry:
if (usingtty)
fprintf(stderr, "%s: ", confirmprompt);
if (fgets(confpassbuf, MAXPASSLEN, readfrom) == NULL) {
fatal(ptx, "Cannot read password");
fatal(ptx, "Cannot read password\n");
goto err2;
}
if (strcmp(passbuf, confpassbuf)) {
@@ -108,7 +108,7 @@ retry:
/* Copy the password out. */
if ((*passwd = strdup(passbuf)) == NULL) {
fatal(ptx, "Cannot allocate memory");
fatal(ptx, "Cannot allocate memory\n");
goto err1;
}