On Fri, Nov 15, 2002 at 03:59:25PM -0800, Julian Elischer wrote: > Here are the diffs to allow disklabel to correctly create partitions > > 1TB (up to 2TB is useful with UFS2) pending a different partitionning > scheme. It also allows you to correctly make smaller partitions beyond > 1TB which is nice if you don't want to waste 800GB on an array :-) > > > permission to commit please? > (pending comments by others) > > (also the sysinstall changes posted before) > (also the bluetooth code) [...] > - int v, lineno = 0, errors = 0; > + unsigned int v; > + int lineno = 0, errors = 0; > int i; [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if ((unsigned)v >= DKMAXTYPES) > fprintf(stderr, "line %d:%s %d\n", lineno, > "Warning, unknown disk type", v);
This cast is redundant since v is already unsigned. The fprintf() format string needs to use %u instead of %d. Use 10 as the base argument to stroul(), not 0 otherwise numbers with leading zeros will be interpreted as octal. [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if (v <= 0 || (v % DEV_BSIZE) != 0) { > fprintf(stderr, > "line %d: %s: bad sector size\n", Should be == 0, not <= 0 since v is unsigned. [...] > - v = atoi(tp); > + v = strtoul(tp, NULL, 0); > if (v < 0) { > fprintf(stderr, "line %d: %s: bad %s\n", > lineno, tp, cp); v < 0 is impossible. Tim To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message