If we fail to open the cache file in fcc_initialize, we could wind up
calling close(-1) which is harmless but incorrect. Avoid this by
initializing fd and conditionalizing its cleanup.
ticket: 8026
char i16buf[2], i32buf[4];
uint16_t fields_len;
ssize_t nwritten;
- int st, fd, flags, version;
+ int st, flags, version, fd = -1;
struct k5buf buf = EMPTY_K5BUF;
krb5_boolean file_locked = FALSE;
k5_buf_free(&buf);
if (file_locked)
krb5_unlock_file(context, fd);
- close(fd);
+ if (fd != -1)
+ close(fd);
k5_cc_mutex_unlock(context, &data->lock);
krb5_change_cache();
return ret;