[gpgme] change work dir

Franz Scheerer fscheerer1 at gmx.de
Sun Dec 12 18:42:23 CET 2004


Hi,

I do not understand the sense behind gpg in general and especially not
the sense of gpgme. 

But I just took a glance on that funny code:

> > -      assert (file_name);

Obivously file_name is expected not to be empty at that point.

> > -      new_file_name = strdup (new_file_name);

I never used strdup before. Therefore I used man.

DESCRIPTION
       The  strdup()  function  returns a pointer to a new string
       which is a duplicate of the string s.  Memory for the  new
       string  is  obtained with malloc(3), and can be freed with
       free(3).

So, strdup does approximately the same as the familiar strcpy, but allocates 
memory for the destination, too. That makes sense, if no memory is allocated 
for the destination new_file_name. But, in this case the argument of strdup 
can not be new_file_name. Most likely one should use file_name (not 
new_file-name) as argument instead, which is not empty as asserted before.

cu Franz




More information about the Gnupg-devel mailing list