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