aboutsummaryrefslogtreecommitdiffstats
path: root/agent/trustlist.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-01-19 17:05:15 +0000
committerWerner Koch <[email protected]>2011-01-19 17:05:15 +0000
commit13acd78a39750e3990684a5bb0951fe0db83fc5a (patch)
tree7dc46bbe5bca79eff51d79c3cd4cdbdc7de12f7d /agent/trustlist.c
parentUse estream for dirmngr's --gpgconf-list. (diff)
downloadgnupg-13acd78a39750e3990684a5bb0951fe0db83fc5a.tar.gz
gnupg-13acd78a39750e3990684a5bb0951fe0db83fc5a.zip
Fixed a CR/LF problem on Windows
Diffstat (limited to 'agent/trustlist.c')
-rw-r--r--agent/trustlist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/agent/trustlist.c b/agent/trustlist.c
index 791df9682..d56598245 100644
--- a/agent/trustlist.c
+++ b/agent/trustlist.c
@@ -139,8 +139,9 @@ read_one_trustfile (const char *fname, int allow_include,
while (es_fgets (line, DIM(line)-1, fp))
{
lnr++;
-
- if (!*line || line[strlen(line)-1] != '\n')
+
+ n = strlen (line);
+ if (!n || line[n-1] != '\n')
{
/* Eat until end of line. */
while ( (c=es_getc (fp)) != EOF && c != '\n')
@@ -151,7 +152,9 @@ read_one_trustfile (const char *fname, int allow_include,
fname, lnr, gpg_strerror (err));
continue;
}
- line[strlen(line)-1] = 0; /* Chop the LF. */
+ line[--n] = 0; /* Chop the LF. */
+ if (n && line[n-1] == '\r')
+ line[--n] = 0; /* Chop an optional CR. */
/* Allow for empty lines and spaces */
for (p=line; spacep (p); p++)