summaryrefslogtreecommitdiff
path: root/tools/include/nolibc/getopt.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/include/nolibc/getopt.h')
-rw-r--r--tools/include/nolibc/getopt.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/include/nolibc/getopt.h b/tools/include/nolibc/getopt.h
index 87565e3b6a33..3ad140f692df 100644
--- a/tools/include/nolibc/getopt.h
+++ b/tools/include/nolibc/getopt.h
@@ -71,7 +71,7 @@ int getopt(int argc, char * const argv[], const char *optstring)
d = optstring[i++];
} while (d && d != c);
- if (d != c || c == ':') {
+ if (!d || d != c || c == ':') {
optopt = c;
if (optstring[0] != ':' && opterr)
fprintf(stderr, "%s: unrecognized option: %c\n", argv[0], *optchar);