Commit 50e4c55afddad7f1001c80f3682ea7400a808747

Guillem Jover 2013-06-08T17:55:19

Try to check if setproctitle() constructor got passed arguments

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/setproctitle.c b/src/setproctitle.c
index 2137190..e4f648a 100644
--- a/src/setproctitle.c
+++ b/src/setproctitle.c
@@ -135,6 +135,10 @@ spt_init(int argc, char *argv[], char *envp[])
 	char *base, *end, *nul, *tmp;
 	int i, error;
 
+	/* Try to make sure we got called with main() arguments. */
+	if (argc < 0)
+		return;
+
 	base = argv[0];
 	if (base == NULL)
 		return;