summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2009-06-02 22:38:46 +0000
committerRay Lai <ray@cvs.openbsd.org>2009-06-02 22:38:46 +0000
commite88010624e0c3e8d768c6df34de36abcf1b3bc93 (patch)
treeca30100bc42564dd7f7ec3bbf9059e67a44ee673
parent4427a4c3b719de300110d9b9e7bf9bc37231c1b3 (diff)
Protect errno.
OK millert
-rw-r--r--libexec/spamd-setup/spamd-setup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libexec/spamd-setup/spamd-setup.c b/libexec/spamd-setup/spamd-setup.c
index d58065807fb..217e299ad54 100644
--- a/libexec/spamd-setup/spamd-setup.c
+++ b/libexec/spamd-setup/spamd-setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd-setup.c,v 1.35 2008/10/03 18:58:52 jmc Exp $ */
+/* $OpenBSD: spamd-setup.c,v 1.36 2009/06/02 22:38:45 ray Exp $ */
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
@@ -463,10 +463,10 @@ add_blacklist(struct bl *bl, size_t *blc, size_t *bls, gzFile gzf, int white)
if (bu == bs) {
tmp = realloc(buf, bs + (1024 * 1024) + 1);
if (tmp == NULL) {
+ serrno = errno;
free(buf);
buf = NULL;
bs = 0;
- serrno = errno;
goto bldone;
}
bs += 1024 * 1024;
@@ -668,7 +668,7 @@ getlist(char ** db_array, char *name, struct blacklist *blist,
struct blacklist *blistnew)
{
char *buf, *method, *file, *message;
- int fd, black = 0;
+ int fd, black = 0, serror;
size_t blc, bls;
struct bl *bl = NULL;
gzFile gzf;
@@ -727,8 +727,10 @@ getlist(char ** db_array, char *name, struct blacklist *blist,
}
free(buf);
bl = add_blacklist(bl, &blc, &bls, gzf, !black);
+ serror = errno;
gzclose(gzf);
if (bl == NULL) {
+ errno = serror;
warn("Could not add %slist %s", black ? "black" : "white",
name);
return (0);