Browse Source

Bugfix: Skip writing configuration of range-limited int options with negative values

These will always be rejected at config-load time.
Fixes real issue with "gpu-platform" being written as -1 when none are available.
Luke Dashjr 13 years ago
parent
commit
b2fe7dbeef
1 changed files with 3 additions and 1 deletions
  1. 3 1
      cgminer.c

+ 3 - 1
cgminer.c

@@ -2893,7 +2893,9 @@ void write_config(FILE *fcfg)
 			   ((void *)opt->cb_arg == (void *)set_int_0_to_9999 ||
 			   (void *)opt->cb_arg == (void *)set_int_1_to_65535 ||
 			   (void *)opt->cb_arg == (void *)set_int_0_to_10 ||
-			   (void *)opt->cb_arg == (void *)set_int_1_to_10) && opt->desc != opt_hidden)
+			   (void *)opt->cb_arg == (void *)set_int_1_to_10) &&
+			   opt->desc != opt_hidden &&
+			   0 <= *(int *)opt->u.arg)
 				fprintf(fcfg, ",\n\"%s\" : \"%d\"", p+2, *(int *)opt->u.arg);
 		}
 	}