*/
#if !defined(lint) && !defined(SABER)
-static char fcc_resolve_c[] = "$Id$";
+static char fcc_close_c[] = "$Id$";
#endif /* !lint && !SABER */
#include <krb5/copyright.h>
krb5_fcc_close(id)
krb5_ccache id;
{
- if (OPENCLOSE(id))
+ if (OPENCLOSE(id)) {
close(((krb5_fcc_data *) id->data)->fd);
-
- free(((krb5_fcc_data *) id->data)->filename);
- free(((krb5_fcc_data *) id->data));
- free(id);
+ ((krb5_fcc_data *) id->data)->fd = -1;
+ }
+ xfree(((krb5_fcc_data *) id->data)->filename);
+ xfree(((krb5_fcc_data *) id->data));
+ xfree(id);
return KRB5_OK;
}
int ret, i;
if (OPENCLOSE(id)) {
- ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data)
- ->filename, O_RDWR, 0);
- if (((krb5_fcc_data *) id->data)->fd < 0)
+ ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0);
+ if (ret < 0)
return errno;
+ ((krb5_fcc_data *) id->data)->fd = ret;
}
else
lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET);
krb5_ccache id;
krb5_cc_cursor *cursor;
{
- if (OPENCLOSE(id))
+ if (OPENCLOSE(id)) {
close(((krb5_fcc_data *) id->data)->fd);
+ ((krb5_fcc_data *) id->data)->fd = -1;
+ }
- free((krb5_fcc_cursor *) *cursor);
+ xfree((krb5_fcc_cursor *) *cursor);
return KRB5_OK;
}