add packages_10.03.2 in preparation for the 10.03.2 interim release
[10.03/packages.git] / utils / mdadm / patches / 200-uclibc_0.9.30_compat.patch
1 --- a/mdadm.h
2 +++ b/mdadm.h
3 @@ -33,6 +33,37 @@ extern __off64_t lseek64 __P ((int __fd,
4  # endif
5  #endif
6  
7 +#ifdef UCLIBC
8 +# include <features.h>
9 +# if __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30
10 +
11 +#include <errno.h>
12 +void *memalign(size_t blocksize, size_t bytes);
13 +static inline int posix_memalign(void **memptr, size_t alignment, size_t size)
14 +{
15 +       if (alignment % sizeof(void *) != 0)
16 +               return EINVAL;
17 +
18 +       *memptr = memalign(alignment, size);
19 +       return (*memptr != NULL ? 0 : ENOMEM);
20 +}
21 +
22 +#include <limits.h>
23 +char *strdup(const char *s);
24 +char *realpath(const char *path, char *resolved_path);
25 +static inline char *canonicalize_file_name(const char *path)
26 +{
27 +       char resolved[PATH_MAX] = { 0 };
28 +
29 +       if (!realpath(path, resolved))
30 +               return NULL;
31 +
32 +       return strdup(resolved);
33 +}
34 +
35 +# endif /* __UCLIBC_MINOR__ <= 9 && __UCLIBC_SUBLEVEL__ <= 30 */
36 +#endif /* UCLIBC */
37 +
38  #include       <sys/types.h>
39  #include       <sys/stat.h>
40  #include       <stdlib.h>