tst-gconv-init-failure-mod.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Test gconv module for tst-gconv-init-failure.
  2. Copyright (C) 2017-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #include <errno.h>
  16. #include <gconv.h>
  17. #include <support/check.h>
  18. #include <support/support.h>
  19. int
  20. gconv (struct __gconv_step *step,
  21. struct __gconv_step_data *data,
  22. const unsigned char **inptrp,
  23. const unsigned char *inend,
  24. unsigned char **outbufstart, size_t *irreversible,
  25. int do_flush, int consume_incomplete)
  26. {
  27. FAIL_EXIT1 ("gconv called");
  28. return __GCONV_INTERNAL_ERROR;
  29. }
  30. int
  31. gconv_init (struct __gconv_step *ignored)
  32. {
  33. write_message ("info: gconv_init called, returning error\n");
  34. errno = ENOMEM;
  35. return __GCONV_NOMEM;
  36. }
  37. int
  38. gconv_end (struct __gconv_step *ignored)
  39. {
  40. FAIL_EXIT1 ("gconv_end called");
  41. return __GCONV_INTERNAL_ERROR;
  42. }