diff options
Diffstat (limited to '')
| -rw-r--r-- | gpgme/ChangeLog | 6 | ||||
| -rw-r--r-- | gpgme/engine-gpgconf.c | 15 | 
2 files changed, 16 insertions, 5 deletions
| diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index f527ba96..8c359598 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,9 @@ +2008-06-20  Werner Koch  <[email protected]> + +	* engine-gpgconf.c (gpgconf_read): Change ARGV initialization for +	compatibility with old compilers.  Fix amount of memmove.  Fix +	CR removal. +  2008-06-19  Werner Koch  <[email protected]>  	* gpgme.h (GPGME_CONF_PATHNAME): Replace by GPGME_CONF_FILENAME, diff --git a/gpgme/engine-gpgconf.c b/gpgme/engine-gpgconf.c index c894dea9..6a9cf2be 100644 --- a/gpgme/engine-gpgconf.c +++ b/gpgme/engine-gpgconf.c @@ -199,7 +199,7 @@ gpgconf_read (void *engine, char *arg1, char *arg2,  #define LINELENGTH 1024    char linebuf[LINELENGTH] = "";    int linelen = 0; -  char *argv[] = { NULL /* file_name */, arg1, arg2, 0 }; +  char *argv[4] = { NULL /* file_name */, NULL, NULL, NULL };    int rp[2];    struct spawn_fd_item_s pfd[] = { {0, -1}, {-1, -1} };    struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */}, {-1, -1} }; @@ -207,6 +207,10 @@ gpgconf_read (void *engine, char *arg1, char *arg2,    int nread;    char *mark = NULL; +  argv[1] = arg1; +  argv[2] = arg2; + +    /* FIXME: Deal with engine->home_dir.  */    /* _gpgme_engine_new guarantees that this is not NULL.  */ @@ -243,20 +247,21 @@ gpgconf_read (void *engine, char *arg1, char *arg2,  	    {                lastmark = mark;  	      if (mark > line && mark[-1] == '\r') -		mark--; -	      *mark = '\0'; +		mark[-1] = '\0'; +              else +                mark[0] = '\0';  	      /* Got a full line.  Due to the CR removal code (which                   occurs only on Windows) we might be one-off and thus                   would see empty lines.  Don't pass them to the                   callback. */ -	      err = *line? (*cb) (hook, line) : NULL; +	      err = *line? (*cb) (hook, line) : 0;  	      if (err)  		goto leave;  	    }            nused = lastmark? (lastmark + 1 - linebuf) : 0; -          memmove (linebuf, linebuf + nused, nused); +          memmove (linebuf, linebuf + nused, linelen - nused);            linelen -= nused;  	}      } | 
