0002-src-check_run.c-fix-build-on-noMMU-platforms.patch 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From c9bebf051aa7e3037ca8e0fe554e073204ffedde Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Fri, 12 Jul 2024 21:27:47 +0200
  4. Subject: [PATCH] src/check_run.c: fix build on noMMU platforms
  5. src/check_run.c defines sig_handler() under the following conditions:
  6. #if defined(HAVE_FORK) && HAVE_FORK==1
  7. however, it does use sig_handler under the following conditions:
  8. #if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
  9. which breaks when HAVE_FORK is defined, but has the value HAVE_FORK=0,
  10. as is the case on noMMU platforms.
  11. This commit fixes this by ensuring that the build conditions are
  12. aligned throughout check_run.c.
  13. Fixes:
  14. src/check_run.c: In function 'srunner_run_tagged':
  15. src/check_run.c:802:38: error: 'sig_handler' undeclared (first use in this function); did you mean 'sa_handler'?
  16. [...]
  17. Upstream: https://github.com/libcheck/check/pull/354
  18. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  19. ---
  20. src/check_run.c | 12 ++++++------
  21. 1 file changed, 6 insertions(+), 6 deletions(-)
  22. diff --git a/src/check_run.c b/src/check_run.c
  23. index 5f160e5..4c370b3 100644
  24. --- a/src/check_run.c
  25. +++ b/src/check_run.c
  26. @@ -772,12 +772,12 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
  27. const char *include_tags, const char *exclude_tags,
  28. enum print_output print_mode)
  29. {
  30. -#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
  31. +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
  32. static struct sigaction sigalarm_old_action;
  33. static struct sigaction sigalarm_new_action;
  34. static struct sigaction sigint_new_action;
  35. static struct sigaction sigterm_new_action;
  36. -#endif /* HAVE_SIGACTION && HAVE_FORK */
  37. +#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
  38. /* Get the selected test suite and test case from the
  39. environment. */
  40. @@ -797,7 +797,7 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
  41. eprintf("Bad print_mode argument to srunner_run_all: %d",
  42. __FILE__, __LINE__, print_mode);
  43. }
  44. -#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
  45. +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
  46. memset(&sigalarm_new_action, 0, sizeof(sigalarm_new_action));
  47. sigalarm_new_action.sa_handler = sig_handler;
  48. sigaction(SIGALRM, &sigalarm_new_action, &sigalarm_old_action);
  49. @@ -809,16 +809,16 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname,
  50. memset(&sigterm_new_action, 0, sizeof(sigterm_new_action));
  51. sigterm_new_action.sa_handler = sig_handler;
  52. sigaction(SIGTERM, &sigterm_new_action, &sigterm_old_action);
  53. -#endif /* HAVE_SIGACTION && HAVE_FORK */
  54. +#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
  55. srunner_run_init(sr, print_mode);
  56. srunner_iterate_suites(sr, sname, tcname, include_tags, exclude_tags,
  57. print_mode);
  58. srunner_run_end(sr, print_mode);
  59. -#if defined(HAVE_SIGACTION) && defined(HAVE_FORK)
  60. +#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1
  61. sigaction(SIGALRM, &sigalarm_old_action, NULL);
  62. sigaction(SIGINT, &sigint_old_action, NULL);
  63. sigaction(SIGTERM, &sigterm_old_action, NULL);
  64. -#endif /* HAVE_SIGACTION && HAVE_FORK */
  65. +#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */
  66. }
  67. void srunner_run(SRunner * sr, const char *sname, const char *tcname,
  68. --
  69. 2.45.2