summaryrefslogtreecommitdiff
path: root/src/setproctitle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setproctitle.c')
-rw-r--r--src/setproctitle.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/setproctitle.c b/src/setproctitle.c
index 99bccf2c0..f44253e16 100644
--- a/src/setproctitle.c
+++ b/src/setproctitle.c
@@ -2,6 +2,8 @@
* setproctitle.c - Linux/Darwin setproctitle.
* --------------------------------------------------------------------------
* Copyright (C) 2010 William Ahern
+ * Copyright (C) 2013 Salvatore Sanfilippo
+ * Copyright (C) 2013 Stam He
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -42,8 +44,9 @@
#if !HAVE_SETPROCTITLE
-#if (defined __linux || defined __APPLE__) && defined __GNUC__
+#if (defined __linux || defined __APPLE__)
+extern char **environ;
static struct {
/* original value */
@@ -142,9 +145,8 @@ static int spt_copyargs(int argc, char *argv[]) {
} /* spt_copyargs() */
-void spt_init(int argc, char *argv[], char *envp[]) __attribute__((constructor));
-
-void spt_init(int argc, char *argv[], char *envp[]) {
+void spt_init(int argc, char *argv[]) {
+ char **envp = environ;
char *base, *end, *nul, *tmp;
int i, error;