From: Marcus Brinkmann Date: Fri, 15 Feb 2008 23:07:29 +0000 (+0000) Subject: 2008-02-15 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~80 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9298440c7a1d7cbf95ba73e3d52bbf14d373a92b;p=gpgme.git 2008-02-15 Marcus Brinkmann * engine-gpgconf.c (gpgconf_read): Fix end-of-line handline. --- 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); } } }