You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.1 KiB

  1. From 1e451ddc15af1a4e19318c8b1ced46c5c41610d3 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Wed, 14 Jul 2021 18:08:30 -0700
  4. Subject: [PATCH] correct signature of closefrom() API
  5. glibc 2.34 introduced this function and finds this error which has been
  6. all along.
  7. Upstream-Status: Pending
  8. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  9. ---
  10. src/util/sys_compat.c | 6 +++---
  11. src/util/sys_defs.h | 12 ++++++------
  12. 2 files changed, 9 insertions(+), 9 deletions(-)
  13. --- a/src/util/sys_compat.c
  14. +++ b/src/util/sys_compat.c
  15. @@ -286,7 +286,7 @@ int dup2_pass_on_exec(int oldd, int
  16. /* closefrom() - closes all file descriptors from the given one up */
  17. -int closefrom(int lowfd)
  18. +void closefrom(int lowfd)
  19. {
  20. int fd_limit = open_limit(0);
  21. int fd;
  22. @@ -298,14 +298,14 @@ int closefrom(int lowfd)
  23. */
  24. if (lowfd < 0) {
  25. errno = EBADF;
  26. - return (-1);
  27. + return;
  28. }
  29. if (fd_limit > 500)
  30. fd_limit = 500;
  31. for (fd = lowfd; fd < fd_limit; fd++)
  32. (void) close(fd);
  33. - return (0);
  34. + return;
  35. }
  36. #endif
  37. --- a/src/util/sys_defs.h
  38. +++ b/src/util/sys_defs.h
  39. @@ -1509,7 +1509,7 @@ extern int setsid(void);
  40. #endif
  41. #ifndef HAS_CLOSEFROM
  42. -extern int closefrom(int);
  43. +extern void closefrom(int);
  44. #endif
  45. @@ -1563,7 +1563,7 @@ typedef int pid_t;
  46. /*
  47. * Clang-style attribute tests.
  48. - *
  49. + *
  50. * XXX Without the unconditional test below, gcc 4.6 will barf on ``elif
  51. * defined(__clang__) && __has_attribute(__whatever__)'' with error message
  52. * ``missing binary operator before token "("''.
  53. @@ -1577,7 +1577,7 @@ typedef int pid_t;
  54. * warn for missing initializations and other trouble. However, OPENSTEP4
  55. * gcc 2.7.x cannot handle this so we define this only if NORETURN isn't
  56. * already defined above.
  57. - *
  58. + *
  59. * Data point: gcc 2.7.2 has __attribute__ (Wietse Venema) but gcc 2.6.3 does
  60. * not (Clive Jones). So we'll set the threshold at 2.7.
  61. */
  62. @@ -1653,12 +1653,12 @@ typedef int pid_t;
  63. * write to output parameters (for example, stat- or scanf-like functions)
  64. * or from functions that have other useful side effects (for example,
  65. * fseek- or rename-like functions).
  66. - *
  67. + *
  68. * DO NOT use this for functions that write to a stream; it is entirely
  69. * legitimate to detect write errors with fflush() or fclose() only. On the
  70. * other hand most (but not all) functions that read from a stream must
  71. * never ignore result values.
  72. - *
  73. + *
  74. * XXX Prepending "(void)" won't shut up GCC. Clang behaves as expected.
  75. */
  76. #if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3)
  77. @@ -1747,7 +1747,7 @@ typedef const char *CONST_CHAR_STAR;
  78. * Safety. On some systems, ctype.h misbehaves with non-ASCII or negative
  79. * characters. More importantly, Postfix uses the ISXXX() macros to ensure
  80. * protocol compliance, so we have to rule out non-ASCII characters.
  81. - *
  82. + *
  83. * XXX The (unsigned char) casts in isalnum() etc arguments are unnecessary
  84. * because the ISASCII() guard already ensures that the values are
  85. * non-negative; the casts are done anyway to shut up chatty compilers.