sprinkel more hx509_set_error_string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18868 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -65,16 +65,24 @@ dir_init(hx509_context context,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = stat(residue, &sb);
|
ret = stat(residue, &sb);
|
||||||
if (ret == -1)
|
if (ret == -1) {
|
||||||
|
hx509_set_error_string(context, 0, ENOENT,
|
||||||
|
"No such file %s", residue);
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((sb.st_mode & S_IFDIR) == 0)
|
if ((sb.st_mode & S_IFDIR) == 0) {
|
||||||
return EINVAL;
|
hx509_set_error_string(context, 0, ENOTDIR,
|
||||||
|
"%s is not a directory", residue);
|
||||||
|
return ENOTDIR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*data = strdup(residue);
|
*data = strdup(residue);
|
||||||
if (*data == NULL)
|
if (*data == NULL) {
|
||||||
|
hx509_clear_error_string(context);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -97,11 +105,14 @@ dir_iter_start(hx509_context context,
|
|||||||
*cursor = NULL;
|
*cursor = NULL;
|
||||||
|
|
||||||
d = calloc(1, sizeof(*d));
|
d = calloc(1, sizeof(*d));
|
||||||
if (d == NULL)
|
if (d == NULL) {
|
||||||
|
hx509_clear_error_string(context);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
d->dir = opendir(data);
|
d->dir = opendir(data);
|
||||||
if (d->dir == NULL) {
|
if (d->dir == NULL) {
|
||||||
|
hx509_clear_error_string(context);
|
||||||
free(d);
|
free(d);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user