diff --git miniupnpd.c miniupnpd.c
index eb68365..62071f4 100644
--- miniupnpd.c
+++ miniupnpd.c
@@ -839,6 +839,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
 	int i;
 	int pid;
 	int debug_flag = 0;
+	int foreground_flag = 0;
 	int openlog_option;
 	struct sigaction sa;
 	/*const char * logfilename = 0;*/
@@ -1235,6 +1236,9 @@ init(int argc, char * * argv, struct runtime_vars * v)
 		case 'd':
 			debug_flag = 1;
 			break;
+		case 'D':
+			foreground_flag = 1;
+			break;
 		case 'w':
 			if(i+1 < argc)
 				presurl = argv[++i];
@@ -1353,7 +1357,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
 		goto print_usage;
 	}
 
-	if(debug_flag)
+	if(debug_flag || foreground_flag)
 	{
 		pid = getpid();
 	}
