gpg_err_code_from_errno usage
Nikos Mavrogiannopoulos
n.mavrogiannopoulos at gmail.com
Sat Mar 11 06:54:54 CET 2006
Hello,
I've noticed quite big parts of libgcrypt use the following
constructions:
array = gcry_calloc (strlen (elems) + 1, sizeof (*array));
if (! array)
err = gpg_err_code_from_errno (errno);
But how can you be sure that calloc() (or in that case gcry_calloc)
will set the errno? calloc is a library call which may or may not use
a system call. Even if it works on some systems, this is a very
non-portable construction, which will result in no error checking in
systems that do not set errno.
More information about the Gcrypt-devel
mailing list