* on close.
*/
fio = fruit_get_complete_fio(handle, fsp);
+ if (fio == NULL) {
+ DBG_ERR("fio=NULL for [%s]\n", fsp_str_dbg(fsp));
+ errno = EBADF;
+ rc = -1;
+ goto exit;
+ }
ref_fio = VFS_ADD_FSP_EXTENSION(handle, ad_fsp,
struct fio,
static int fruit_close_meta(vfs_handle_struct *handle,
files_struct *fsp)
{
- struct fio *fio = fruit_get_complete_fio(handle, fsp);
int ret;
struct fruit_config_data *config = NULL;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1);
- if (fio == NULL) {
- return -1;
- }
-
switch (config->meta) {
case FRUIT_META_STREAM:
+ {
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
+ if (fio == NULL) {
+ return -1;
+ }
if (fio->fake_fd) {
ret = vfs_fake_fd_close(fsp_get_pathref_fd(fsp));
fsp_set_fd(fsp, -1);
ret = SMB_VFS_NEXT_CLOSE(handle, fsp);
}
break;
-
+ }
case FRUIT_META_NETATALK:
ret = vfs_fake_fd_close(fsp_get_pathref_fd(fsp));
fsp_set_fd(fsp, -1);
static int fruit_close_rsrc(vfs_handle_struct *handle,
files_struct *fsp)
{
- struct fio *fio = fruit_get_complete_fio(handle, fsp);
int ret;
struct fruit_config_data *config = NULL;
break;
case FRUIT_RSRC_ADFILE:
+ {
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
+ if (fio == NULL) {
+ return -1;
+ }
fio_close_ad_fsp(fio);
ret = vfs_fake_fd_close(fsp_get_pathref_fd(fsp));
fsp_set_fd(fsp, -1);
break;
+ }
case FRUIT_RSRC_XATTR:
ret = vfs_fake_fd_close(fsp_get_pathref_fd(fsp));
struct adouble *ad = NULL;
ssize_t nread;
- if (fio->ad_fsp == NULL) {
- DBG_ERR("ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
+ if (fio == NULL || fio->ad_fsp == NULL) {
+ DBG_ERR("fio/ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
errno = EBADF;
return -1;
}
ssize_t nwritten;
int ret;
- if (fio->ad_fsp == NULL) {
- DBG_ERR("ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
+ if (fio == NULL || fio->ad_fsp == NULL) {
+ DBG_ERR("fio/ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
errno = EBADF;
return -1;
}
struct adouble *ad = NULL;
int ret;
- if (fio->ad_fsp == NULL) {
- DBG_ERR("ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
+ if (fio == NULL || fio->ad_fsp == NULL) {
+ DBG_ERR("fio/ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
errno = EBADF;
return -1;
}
struct adouble *ad = NULL;
off_t ad_off;
- if (fio->ad_fsp == NULL) {
- DBG_ERR("ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
+ if (fio == NULL || fio->ad_fsp == NULL) {
+ DBG_ERR("fio/ad_fsp=NULL for [%s]\n", fsp_str_dbg(fsp));
errno = EBADF;
return -1;
}