Files
RedBear-OS/local/recipes/libs/libgpg-error/source/tests/t-syserror.c
T
vasilito c825f470cb
redbear-ci / check (push) Has been cancelled
libs: vendor libgcrypt 1.11.1 + libgpg-error 1.55; wire into kf6-kwallet
kf6-kwallet's kwalletbackend hard-requires LibGcrypt 1.5.0 for PBKDF2 key
derivation and the GPG-backed wallet format. Vendor both libraries under the
full-fork model (committed source/, offline-reproducible) and add libgcrypt to
kf6-kwallet's dependencies.

Release tarballs ship a pre-generated configure and a config.sub that already
recognises the *-redox triple, so no autotools regeneration is needed at cook
time. libgpg-error supplies a generic pthread-backed gpgrt_lock_t for Redox via
its build script; the test-only redox.patch (tms/times stub) is baked into
libgcrypt's source and kept alongside for future version bumps.

Promoted from the stale recipes/wip copies (now .disabled).
2026-08-02 04:29:16 +03:00

89 lines
2.0 KiB
C

/* t-syserror.c - System error specific regression test.
Copyright (C) 2006 g10 Code GmbH
This file is part of libgpg-error.
libgpg-error is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
libgpg-error is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with libgpgme-error; if not, write to the Free
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <errno.h>
#include <gpg-error.h>
int
main (int argc, char *argv[])
{
FILE *fp;
int save_errno;
gpg_err_code_t ec;
(void)argc;
(void)argv;
fp = fopen ("/does-not-exist/110761/nowhere.foo", "r");
if (fp)
{
fclose (fp);
fp = fopen (" no this file does not exists foo 4711", "r");
}
if (fp)
{
fclose (fp);
fprintf (stderr, "unable to run test\n");
return 1;
}
save_errno = errno;
ec = gpg_err_code_from_syserror ();
if (ec != GPG_ERR_ENOENT)
{
fprintf (stderr, "fopen failed with bad code: %d\n", save_errno);
return 1;
}
if (ec != gpg_err_code_from_errno (save_errno))
{
fprintf (stderr, "oops at %d\n",__LINE__);
return 1;
}
gpg_err_set_errno (0);
ec = gpg_err_code_from_syserror ();
if (ec != GPG_ERR_MISSING_ERRNO)
{
fprintf (stderr, "oops at %d\n",__LINE__);
return 1;
}
if ( gpg_err_code_from_errno (0) )
{
fprintf (stderr, "oops at %d\n",__LINE__);
return 1;
}
return 0;
}