Changeset: f68a5814bcc1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f68a5814bcc1
Modified Files:
sql/src/benchmarks/tpch/dbgen/driver.c
Branch: Oct2010
Log Message:
Remove source of possible segfault.
The standard library's optind value is the index of the *next* index,
which may thus well be equal to count, and so vector[optind] may well
be NULL. Furthermore, the standard library version of getopt (at
least on Linux) already prints a message. Our own version's optind
seems to be the index of the *current* option.
By the way, the macro seems to be inappropriately named.
diffs (14 lines):
diff -r 4bc9c5336c6f -r f68a5814bcc1 sql/src/benchmarks/tpch/dbgen/driver.c
--- a/sql/src/benchmarks/tpch/dbgen/driver.c Thu Oct 14 22:35:12 2010 +0200
+++ b/sql/src/benchmarks/tpch/dbgen/driver.c Fri Oct 15 10:36:33 2010 +0200
@@ -746,8 +746,10 @@
strcpy (db_name, optarg);
break;
default:
+#ifdef STDLIB_HAS_GETOPT /* standard library already prints something */
printf ("ERROR: option '%c' unknown.\n",
*(vector[optind] + 1));
+#endif
case 'h': /* something
unexpected */
fprintf (stderr,
"%s Population Generator (Version
%d.%d.%d%s)\n",
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list