From 9298440c7a1d7cbf95ba73e3d52bbf14d373a92b Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 15 Feb 2008 23:07:29 +0000 Subject: [PATCH] 2008-02-15 Marcus Brinkmann * engine-gpgconf.c (gpgconf_read): Fix end-of-line handline. --- trunk/gpgme/ChangeLog | 4 ++++ trunk/gpgme/engine-gpgconf.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 9ac1f61..2a5c719 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2008-02-15 Marcus Brinkmann + + * engine-gpgconf.c (gpgconf_read): Fix end-of-line handline. + 2008-02-14 Werner Koch * w32-io.c (_gpgme_io_spawn): Add arg R_PID to return the pid. diff --git a/trunk/gpgme/engine-gpgconf.c b/trunk/gpgme/engine-gpgconf.c index 26cd45f..ab03e9d 100644 --- a/trunk/gpgme/engine-gpgconf.c +++ b/trunk/gpgme/engine-gpgconf.c @@ -232,24 +232,24 @@ gpgconf_read (void *engine, char *arg1, char *arg2, nread = _gpgme_io_read (rp[0], &line[linelen], LINELENGTH - linelen - 1); if (nread > 0) { - line[linelen + nread] = '\0'; linelen += nread; + line[linelen] = '\0'; while ((mark = strchr (line, '\n'))) { char *eol = mark; - if (eol > &line[0] && *eol == '\r') + if (eol > line && eol[-1] == '\r') eol--; *eol = '\0'; - + /* Got a full line. */ err = (*cb) (hook, line); if (err) break; - linelen -= mark - line; - memmove (line, eol + 1, linelen); + linelen -= mark + 1 - line; + memmove (line, mark + 1, linelen); } } } -- 2.26.2