]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - ipc.c
client: Fix memory leak on exit.
[paraslash.git] / ipc.c
diff --git a/ipc.c b/ipc.c
index 3cc5c15695a76c0442b1ceb4da889c6f5b2baeb1..c245f690788630e19f2c7e82bda903360e1c0fa5 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -1,8 +1,4 @@
-/*
- * Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file ipc.c Inter-process communication and shared memory helpers. */
 
@@ -11,7 +7,6 @@
 #include "ipc.h"
 #include <sys/types.h>
 #include <sys/param.h>
-#include <sys/sysctl.h>
 
 #include <sys/ipc.h>
 #include <sys/shm.h>
@@ -198,9 +193,8 @@ int shm_detach(void *addr)
 }
 
 # if defined __FreeBSD__ || defined __NetBSD__
+#include <sys/sysctl.h>
 #      define SYSCTL_SHMMAX_VARIABLE "kern.ipc.shmmax"
-# elif defined __APPLE__
-#      define SYSCTL_SHMMAX_VARIABLE "kern.sysv.shmmax"
 # else
 #      undef SYSCTL_SHMMAX_VARIABLE
 # endif
@@ -224,7 +218,7 @@ size_t shm_get_shmmax(void)
        {
                int fd = open("/proc/sys/kernel/shmmax", O_RDONLY);
                if (fd >= 0) {
-                       char buf[100] = "";
+                       char buf[100];
                        int ret = read(fd, buf, sizeof(buf) - 1);
                        if (ret > 0) {
                                buf[ret] = '\0';