Skip to content

Commit

Permalink
Fix getopt_long() usage
Browse files Browse the repository at this point in the history
The return value of getopt_long() was being stored in a "char".
On some platforms, "char" is unsigned.  In that case, the capstats
command would never work (it would just exit with a usage message).
Fixed by using the correct return value type ("int") of getopt_long().
  • Loading branch information
Daniel Thayer committed Oct 4, 2013
1 parent 0d88a50 commit ca8504d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions capstats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@ int main(int argc, char **argv)
{
while (1) {
#ifdef USE_DAG
char c = getopt_long (argc, argv, "df:i:I:n:Npq:s:lvw:S:", long_options, 0);
int c = getopt_long (argc, argv, "df:i:I:n:Npq:s:lvw:S:", long_options, 0);
#else
char c = getopt_long (argc, argv, "f:i:I:n:Npq:s:lvw:S:", long_options, 0);
int c = getopt_long (argc, argv, "f:i:I:n:Npq:s:lvw:S:", long_options, 0);
#endif

if ( c == -1 )
Expand Down

0 comments on commit ca8504d

Please sign in to comment.