summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-23 14:45:33 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-23 14:45:33 +0400
commit18ce6f0c60f1125c5344d9fd8e90e5ea2941bf01 (patch)
treeeb79d0b925375a19aae1f7e88323621990c72150 /src/util.c
parent80e9384ebfaca000eb7f0693a466795f51e3f29d (diff)
downloadrspamd-18ce6f0c60f1125c5344d9fd8e90e5ea2941bf01.tar.gz
rspamd-18ce6f0c60f1125c5344d9fd8e90e5ea2941bf01.zip
* Fix compatibility issues
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 7e9aeb463..67b93337e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -112,6 +112,8 @@ make_inet_socket (int family, struct in_addr *addr, u_short port, gboolean is_se
goto out;
}
+ memset (&sin, 0, sizeof (sin));
+
/* Bind options */
sin.sin_family = AF_INET;
sin.sin_port = htons (port);
@@ -418,6 +420,10 @@ setproctitle (const char *fmt, ...)
int
init_title (int argc, char *argv[], char *envp[])
{
+#if defined(DARWIN) || defined(SOLARIS)
+ /* XXX: try to handle these OSes too */
+ return 0;
+#else
char *begin_of_buffer = 0, *end_of_buffer = 0;
int i;
@@ -478,6 +484,7 @@ init_title (int argc, char *argv[], char *envp[])
}
g_free (new_environ);
return 0;
+#endif
}
#endif
@@ -541,7 +548,7 @@ pidfile_open (const char *path, mode_t mode, pid_t * pidptr)
return NULL;
if (path == NULL)
- len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "/var/run/%s.pid", __progname);
+ len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "/var/run/%s.pid", g_get_prgname ());
else
len = snprintf (pfh->pf_path, sizeof (pfh->pf_path), "%s", path);
if (len >= (int)sizeof (pfh->pf_path)) {
@@ -626,7 +633,7 @@ pidfile_write (struct pidfh *pfh)
return -1;
}
- snprintf (pidstr, sizeof (pidstr), "%u", getpid ());
+ snprintf (pidstr, sizeof (pidstr), "%lu", (long unsigned)getpid ());
if (pwrite (fd, pidstr, strlen (pidstr), 0) != (ssize_t) strlen (pidstr)) {
error = errno;
_pidfile_remove (pfh, 0);