002-mkostemp.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Support older hosts with latest util-linux-native
  2. mkostemp is not defined on older machines. So we detect this and
  3. provide a define that uses mkstemp instead.
  4. O_CLOEXEC is not defined on older machines. It is however defined
  5. in the 'c.h' header. Fix up the users to include 'c.h'.
  6. fdisks/fdisksunlabel.c was modified to use qsort_r, however
  7. this is not defined on older hosts. Revert:
  8. commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
  9. fdisk: (sun): use ask API, remove global variable
  10. Upstream-Status: Inappropriate [other]
  11. Patches revert upstream changes in order to support older
  12. machines.
  13. Signed-off-by: Mark Hatle <[email protected]>
  14. --- a/configure.ac
  15. +++ b/configure.ac
  16. @@ -299,6 +299,7 @@ AC_CHECK_FUNCS([ \
  17. llseek \
  18. lseek64 \
  19. mempcpy \
  20. + mkostemp \
  21. nanosleep \
  22. personality \
  23. posix_fadvise \
  24. --- a/include/c.h
  25. +++ b/include/c.h
  26. @@ -236,6 +236,13 @@ static inline int dirfd(DIR *d)
  27. #endif
  28. /*
  29. + * mkostemp replacement
  30. + */
  31. +#ifndef HAVE_MKOSTEMP
  32. +#define mkostemp(template, flags) mkstemp(template)
  33. +#endif
  34. +
  35. +/*
  36. * MAXHOSTNAMELEN replacement
  37. */
  38. static inline size_t get_hostname_max(void)
  39. --- a/lib/randutils.c
  40. +++ b/lib/randutils.c
  41. @@ -16,6 +16,7 @@
  42. #include <sys/syscall.h>
  43. #include "randutils.h"
  44. +#include "c.h"
  45. #ifdef HAVE_TLS
  46. #define THREAD_LOCAL static __thread
  47. --- a/lib/wholedisk.c
  48. +++ b/lib/wholedisk.c
  49. @@ -10,6 +10,7 @@
  50. #include "blkdev.h"
  51. #include "wholedisk.h"
  52. +#include "c.h"
  53. int is_whole_disk_fd(int fd, const char *name)
  54. {