return ret;
}
+static int snapper_gmt_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname_in,
+ struct files_struct *fsp,
+ int flags,
+ mode_t mode)
+{
+ struct smb_filename *smb_fname = NULL;
+ time_t timestamp;
+ char *stripped = NULL;
+ int ret;
+ int saved_errno = 0;
+
+ if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+ smb_fname_in,
+ ×tamp, &stripped)) {
+ return -1;
+ }
+ if (timestamp == 0) {
+ return SMB_VFS_NEXT_OPENAT(handle,
+ dirfsp,
+ smb_fname_in,
+ fsp,
+ flags,
+ mode);
+ }
+
+ smb_fname = cp_smb_filename(talloc_tos(), smb_fname_in);
+ if (smb_fname == NULL) {
+ TALLOC_FREE(stripped);
+ return -1;
+ }
+
+ smb_fname->base_name = snapper_gmt_convert(smb_fname, handle,
+ stripped, timestamp);
+ TALLOC_FREE(stripped);
+
+ if (smb_fname->base_name == NULL) {
+ TALLOC_FREE(smb_fname);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
+ return ret;
+}
+
static int snapper_gmt_unlinkat(vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
.stat_fn = snapper_gmt_stat,
.lstat_fn = snapper_gmt_lstat,
.open_fn = snapper_gmt_open,
+ .openat_fn = snapper_gmt_openat,
.unlinkat_fn = snapper_gmt_unlinkat,
.chmod_fn = snapper_gmt_chmod,
.chdir_fn = snapper_gmt_chdir,