return rc;
}
-static int fruit_fake_fd(void)
-{
- int pipe_fds[2];
- int fd;
- int ret;
-
- /*
- * Return a valid fd, but ensure any attempt to use it returns
- * an error (EPIPE). Once we get a write on the handle, we open
- * the real fd.
- */
- ret = pipe(pipe_fds);
- if (ret != 0) {
- return -1;
- }
- fd = pipe_fds[0];
- close(pipe_fds[1]);
-
- return fd;
-}
-
static int fruit_open_meta_stream(vfs_handle_struct *handle,
const struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
return -1;
}
- fd = fruit_fake_fd();
+ fd = vfs_fake_fd();
if (fd == -1) {
VFS_REMOVE_FSP_EXTENSION(handle, fsp);
return -1;
return -1;
}
- fd = fruit_fake_fd();
+ fd = vfs_fake_fd();
if (fd == -1) {
return -1;
}
struct stream_io *sio = NULL;
struct ea_struct ea;
char *xattr_name = NULL;
- int pipe_fds[2];
int fakefd = -1;
bool set_empty_xattr = false;
int ret;
}
}
- /*
- * Return a valid fd, but ensure any attempt to use it returns an error
- * (EPIPE).
- */
- ret = pipe(pipe_fds);
- if (ret != 0) {
- goto fail;
- }
-
- close(pipe_fds[1]);
- pipe_fds[1] = -1;
- fakefd = pipe_fds[0];
+ fakefd = vfs_fake_fd();
sio = VFS_ADD_FSP_EXTENSION(handle, fsp, struct stream_io, NULL);
if (sio == NULL) {
unsigned int *num_streams,
struct stream_struct **streams);
void init_smb_file_time(struct smb_file_time *ft);
+int vfs_fake_fd(void);
/* The following definitions come from smbd/avahi_register.c */
streams);
}
+int vfs_fake_fd(void)
+{
+ int pipe_fds[2];
+ int ret;
+
+ /*
+ * Return a valid fd, but ensure any attempt to use
+ * it returns an error (EPIPE).
+ */
+ ret = pipe(pipe_fds);
+ if (ret != 0) {
+ return -1;
+ }
+
+ close(pipe_fds[1]);
+ return pipe_fds[0];
+}
+
/*
generate a file_id from a stat structure
*/