Home GnuPG
Diffusion GnuPG 407f5f9baea5

gpg: Don't assume that strtoul interprets "" as 0.
407f5f9baea5Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

gpg: Don't assume that strtoul interprets "" as 0.

* g10/tofu.c (show_statistics): If there are not records, return 0
instead of NULL.

According to SUSv3:

If the subject sequence is empty or does not have the expected form,
no conversion is performed
...
If no conversion could be performed, 0 is returned and errno may be
set to [EINVAL].

http://pubs.opengroup.org/onlinepubs/007908799/xsh/strtol.html

It appears that MacOS X sets errno to EINVAL, but glibc doesn't.
Hence, we map NULL to 0 explicitly.

  • Signed-off-by: Neal H. Walfield <neal@g10code.com>
  • GnuPG-bug-id: T2853

Details

Provenance
Neal H. Walfield <neal@g10code.com>Authored on Feb 2 2017, 3:48 PM
Parents
rG64be8e1e8607: tests: Improve description of test.
Branches
Unknown
Tags
Unknown