summaryrefslogtreecommitdiff
path: root/mh
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2003-03-15 23:23:24 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2003-03-15 23:23:24 +0000
commitc78a92659a1ae097bd92947aeb68efd88e26d3e4 (patch)
tree176c63b023ebec3b936a789de230158853d6d799 /mh
parentdeaa3c285a4929a9b6a8ff6ab597274249aa5364 (diff)
downloadmailutils-c78a92659a1ae097bd92947aeb68efd88e26d3e4.tar.gz
mailutils-c78a92659a1ae097bd92947aeb68efd88e26d3e4.tar.bz2
Bugfix. Thanks Wojciech for noticing!
Diffstat (limited to 'mh')
-rw-r--r--mh/mh_ctx.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mh/mh_ctx.c b/mh/mh_ctx.c
index 2f1d60795..9d2eb0a84 100644
--- a/mh/mh_ctx.c
+++ b/mh/mh_ctx.c
@@ -48,6 +48,9 @@ mh_context_read (mh_context_t *ctx)
struct stat st;
FILE *fp;
+ if (!ctx)
+ return EINVAL;
+
if (stat (ctx->name, &st))
return errno;
@@ -79,6 +82,9 @@ mh_context_write (mh_context_t *ctx)
size_t off = 0, n;
FILE *fp;
+ if (!ctx)
+ return EINVAL;
+
fp = fopen (ctx->name, "w");
if (!fp)
{
@@ -117,7 +123,7 @@ mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval)
{
char *p;
- if (header_aget_value (ctx->header, name, &p))
+ if (!ctx || header_aget_value (ctx->header, name, &p))
p = (char *) defval;
return p;
}
@@ -125,6 +131,8 @@ mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval)
int
mh_context_set_value (mh_context_t *ctx, const char *name, const char *value)
{
+ if (!ctx)
+ return EINVAL;
if (!ctx->header)
{
int rc;
@@ -145,6 +153,8 @@ mh_context_iterate (mh_context_t *ctx, mh_context_iterator fp, void *data)
size_t i, nfields;
int rc = 0;
+ if (!ctx)
+ return EINVAL;
header_get_field_count (ctx->header, &nfields);
for (i = 1; i <= nfields && rc == 0; i++)
{

Return to:

Send suggestions and report system problems to the System administrator.