[patch] burncd: honour for envar SPEED
Alexander Best
alexbestms at math.uni-muenster.de
Mon Nov 9 01:22:44 UTC 2009
Gabor Kovesdan schrieb am 2009-11-09:
> Gabor Kovesdan escribió:
> >Alexander Best escribió:
> >>any thoughts on these small changes to burncd?
> >> - int nogap = 0, speed = 4 * 177, test_write = 0, force = 0;
> >>+ int nogap = 0, speed = 0, test_write = 0, force = 0;
> >> int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0;
> >> const char *dev;
> >> if ((dev = getenv("CDROM")) == NULL)
> >> dev = "/dev/acd0";
> >>+ if ((speed = getenv("SPEED")) == NULL)
> >>+ speed = 4 * 177;
> >>+
> >It seems incorrect. The speed variable is of type int, while getenv
> >returns char *. You should first assign getenv("SPEED") to a char *
> >variable and if it isn't NULL then you should convert it to int or
> >fall back to the default value otherwise.
> And one more thing. Personally, I think that a more
> specific/descriptive name would be better, e.g. BURNCD_SPEED. SPEED
> is just too general.
> --
> Gabor Kovesdan
> FreeBSD Volunteer
> EMAIL: gabor at FreeBSD.org .:|:. gabor at kovesdan.org
> WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org
ooops. this one fixes the typos. ;)
alex
-------------- next part --------------
--- burncd.c.typo 2009-11-09 02:19:47.000000000 +0100
+++ burncd.c 2009-11-09 02:20:27.000000000 +0100
@@ -85,8 +85,8 @@
if ((dev = getenv("CDROM")) == NULL)
dev = "/dev/acd0";
- if ((env_speed = getenv("WRITE_SPEED")) != NULL)
- if (strcasecmp("max", getenv) == 0)
+ if ((env_speed = getenv("WRITE_SPEED")) != NULL) {
+ if (strcasecmp("max", env_speed) == 0)
speed = CDR_MAX_SPEED;
else
speed = atoi(env_speed) * 177;
More information about the freebsd-hackers
mailing list