summaryrefslogtreecommitdiff
path: root/nuttx/lib
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-23 15:04:50 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-08-23 15:04:50 +0000
commitee59fcd6ea973d6f14e0e2a9499bc68d8851a70a (patch)
treeeed795a823e9a90595fb609a56983738092b3c25 /nuttx/lib
parentb052fa8f2dfe59faf33a5a70b80062c5a6f75222 (diff)
downloadpx4-nuttx-ee59fcd6ea973d6f14e0e2a9499bc68d8851a70a.tar.gz
px4-nuttx-ee59fcd6ea973d6f14e0e2a9499bc68d8851a70a.tar.bz2
px4-nuttx-ee59fcd6ea973d6f14e0e2a9499bc68d8851a70a.zip
fix error in getopt with no arguments
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@839 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib')
-rw-r--r--nuttx/lib/lib_getopt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nuttx/lib/lib_getopt.c b/nuttx/lib/lib_getopt.c
index e73ae68d5..ab770bb0d 100644
--- a/nuttx/lib/lib_getopt.c
+++ b/nuttx/lib/lib_getopt.c
@@ -103,7 +103,7 @@ static boolean g_binitialized = FALSE;
int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
{
- if (argv && optstring)
+ if (argv && optstring && argc > 1)
{
int noarg_ret = '?';
char *optchar;
@@ -161,8 +161,8 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
}
/* We are starting at the beginning of argv[optind]. In this case, the
- * first character must be '-'
- */
+ * first character must be '-'
+ */
g_optptr = argv[optind];
if (*g_optptr != '-')