version 1.88, 2014/05/16 18:35:01 |
version 1.89, 2014/05/30 21:17:42 |
|
|
{ |
{ |
void *p; |
void *p; |
|
|
p = malloc(len); |
if (!(p = malloc(len))) |
if (!p) |
|
err(1, "malloc %zu", len); |
err(1, "malloc %zu", len); |
return p; |
return p; |
} |
} |
|
|
COMMENTMAXLEN) >= COMMENTMAXLEN) |
COMMENTMAXLEN) >= COMMENTMAXLEN) |
errx(1, "comment too long"); |
errx(1, "comment too long"); |
} |
} |
b64end = strchr(commentend + 1, '\n'); |
if (!(b64end = strchr(commentend + 1, '\n'))) |
if (!b64end) |
|
errx(1, "missing new line after base64 in %s", filename); |
errx(1, "missing new line after base64 in %s", filename); |
*b64end = '\0'; |
*b64end = '\0'; |
if (b64_pton(commentend + 1, buf, buflen) != buflen) |
if (b64_pton(commentend + 1, buf, buflen) != buflen) |
|
|
int rv, fd; |
int rv, fd; |
|
|
fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0); |
fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0); |
rv = read(fd, b64, sizeof(b64) - 1); |
if ((rv = read(fd, b64, sizeof(b64) - 1)) == -1) |
if (rv == -1) |
|
err(1, "read from %s", filename); |
err(1, "read from %s", filename); |
b64[rv] = '\0'; |
b64[rv] = '\0'; |
parseb64file(filename, b64, buf, buflen, comment); |
parseb64file(filename, b64, buf, buflen, comment); |
|
|
ssize_t x; |
ssize_t x; |
|
|
while (buflen != 0) { |
while (buflen != 0) { |
x = write(fd, buf, buflen); |
if ((x = write(fd, buf, buflen)) == -1) |
if (x == -1) |
|
err(1, "write to %s", filename); |
err(1, "write to %s", filename); |
buflen -= x; |
buflen -= x; |
buf = (char *)buf + x; |
buf = (char *)buf + x; |
|
|
{ |
{ |
void *p; |
void *p; |
|
|
p = calloc(s1, s2); |
if (!(p = calloc(s1, s2))) |
if (!p) |
|
err(1, "calloc"); |
err(1, "calloc"); |
return p; |
return p; |
} |
} |