Proposal with patch: Make socket directory host dependent

Werner Koch wk at
Wed Dec 20 15:32:17 CET 2017

On Wed, 20 Dec 2017 12:48, rainer.perske at said:

> I do not understand yet how the figures 13 + 1 + 20 are calculated. 

char prefix[13 + 1 + 20 + 6 + 1];

/var/run/user -> 13
/             -> 1
UID           -> 20 (for a 64 bit unsigned integer)
/gnupg        -> 6
nul           -> 1

and indeed I did not add 6 extra bytes for the leading "/gnupg".
However, it is not a problem:  A 32 bit user id (e.g. 2147483647) does
only need 10 bytes and thus there is enough space for the extra string.
If the ID would really grow to a larger 64 bit value, this will not
work anymore and the explict check will let it return an error.

Although I tested this I obviously did not noticed that we will end up
with a socket directory


The second gnupg would not be needed.  The question is whether to remove
it or to keep it for code simplicity.  I will fix the size of the
prefix, though.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <>

More information about the Gnupg-devel mailing list