diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c
index ff379db..c989276 100644
--- a/src/port/getopt_long.c
+++ b/src/port/getopt_long.c
@@ -79,14 +79,22 @@ getopt_long(int argc, char *const argv[],
 
 		place++;
 
-		if (place[0] && place[0] == '-' && place[1] == '\0')
-		{						/* found "--" */
+		if (!*place)
+		{
+			/* treat "-" as not being an option */
+			place = EMSG;
+			return -1;
+		}
+
+		if (place[0] == '-' && place[1] == '\0')
+		{
+			/* found "--", treat it as end of options */
 			++optind;
 			place = EMSG;
 			return -1;
 		}
 
-		if (place[0] && place[0] == '-' && place[1])
+		if (place[0] == '-' && place[1])
 		{
 			/* long option */
 			size_t		namelen;
