summaryrefslogtreecommitdiff
path: root/lib/libc/unistd/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/unistd/getopt.c')
-rw-r--r--lib/libc/unistd/getopt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/unistd/getopt.c b/lib/libc/unistd/getopt.c
index 0a3b38cb..c942da56 100644
--- a/lib/libc/unistd/getopt.c
+++ b/lib/libc/unistd/getopt.c
@@ -56,7 +56,7 @@ int getopt(int argc, char *const argv[], const char *optstring)
} while (d && d != c);
if (d != c || c == ':') {
- optopt = c;
+ optopt = (unsigned char)c;
if (optstring[0] != ':' && opterr) {
struct iovec iov[4];
char opt_char[2] = { *optchar, '\0' };
@@ -85,7 +85,7 @@ int getopt(int argc, char *const argv[], const char *optstring)
optpos = 0;
}
if (optind > argc) {
- optopt = c;
+ optopt = (unsigned char)c;
if (optstring[0] == ':') {
return ':';
}