automake build system
[mech_eap.orig] / src / utils / os_unix.c
index cb23f72..c696fae 100644 (file)
@@ -135,9 +135,9 @@ static int os_daemon(int nochdir, int noclose)
 
 int os_daemonize(const char *pid_file)
 {
-#ifdef __uClinux__
+#if defined(__uClinux__) || defined(__sun__)
        return -1;
-#else /* __uClinux__ */
+#else /* defined(__uClinux__) || defined(__sun__) */
        if (os_daemon(0, 0)) {
                perror("daemon");
                return -1;
@@ -152,7 +152,7 @@ int os_daemonize(const char *pid_file)
        }
 
        return -0;
-#endif /* __uClinux__ */
+#endif /* defined(__uClinux__) || defined(__sun__) */
 }
 
 
@@ -370,7 +370,7 @@ void * os_realloc(void *ptr, size_t size)
        if (ptr == NULL)
                return os_malloc(size);
 
-       a = ptr - sizeof(*a);
+       a = (struct os_alloc_trace *) ptr - 1;
        if (a->magic != ALLOC_MAGIC) {
                wpa_printf(MSG_INFO, "REALLOC[%p]: invalid magic 0x%x%s",
                           a, a->magic,
@@ -396,7 +396,7 @@ void os_free(void *ptr)
 
        if (ptr == NULL)
                return;
-       a = ptr - sizeof(*a);
+       a = (struct os_alloc_trace *) ptr - 1;
        if (a->magic != ALLOC_MAGIC) {
                wpa_printf(MSG_INFO, "FREE[%p]: invalid magic 0x%x%s",
                           a, a->magic,