summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fe3cd8b)
raw | patch | inline | side by side (parent: fe3cd8b)
author | octo <octo> | |
Tue, 11 Apr 2006 22:24:37 +0000 (22:24 +0000) | ||
committer | octo <octo> | |
Tue, 11 Apr 2006 22:24:37 +0000 (22:24 +0000) |
src/apple_sensors.c | patch | blob | history |
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index a8f92a548654aa110d25c6b0852f576adde8179c..24e8f977cdd8454c81fc704185fb35400746ec1a 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
#if HAVE_CTYPE_H
# include <ctype.h>
#endif
+
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
#endif
#if HAVE_MACH_MACH_ERROR_H
# include <mach/mach_error.h>
#endif
+#if HAVE_MACH_MACH_PORT_H
+# include <mach/mach_port.h>
+#endif
#if HAVE_COREFOUNDATION_COREFOUNDATION_H
# include <CoreFoundation/CoreFoundation.h>
#endif
# define IOKIT_HAVE_READ 0
#endif
-#if IOKIT_HAVE_READ
-static mach_port_t io_master_port;
+#if HAVE_IOKIT_IOKITLIB_H
+static mach_port_t io_master_port = MACH_PORT_NULL;
#endif
static char *temperature_file = "apple_sensors/temperature-%s.rrd";
#if IOKIT_HAVE_READ
kern_return_t status;
- /* FIXME: de-allocate port if it's defined */
+ if (io_master_port != MACH_PORT_NULL)
+ {
+ mach_port_deallocate (mach_task_self (),
+ io_master_port);
+ io_master_port = MACH_PORT_NULL;
+ }
status = IOMasterPort (MACH_PORT_NULL, &io_master_port);
if (status != kIOReturnSuccess)
io_master_port = MACH_PORT_NULL;
return;
}
-#endif
+#endif /* IOKIT_HAVE_READ */
return;
}