fixed tsmsm_sendfile(). The logic was totally broken.
authorAndrew Tridgell <tridge@samba.org>
Sat, 23 Aug 2008 01:36:27 +0000 (11:36 +1000)
committerKarolin Seeger <kseeger@samba.org>
Mon, 8 Sep 2008 09:25:02 +0000 (11:25 +0200)
(cherry picked from commit 794e48b809036871287df8416a2c669b7e26f216)
(cherry picked from commit 3ce3f7f58402b98ce386bab1c40988e5ccd40d15)

source/modules/vfs_tsmsm.c

index 4a732bc..d56c5aa 100644 (file)
@@ -279,10 +279,13 @@ static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_s
 static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr,
                              SMB_OFF_T offset, size_t n)
 {
-       bool file_online = tsmsm_aio_force(handle, fsp);
+       bool file_offline = tsmsm_aio_force(handle, fsp);
 
-       if(!file_online) 
-           return ENOSYS;
+       if (file_offline) {
+               DEBUG(10,("tsmsm_sendfile on offline file - rejecting\n"));
+               errno = ENOSYS;
+               return -1;
+       }
            
        return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n);
 }
@@ -333,7 +336,7 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle,
 
        if (tsmd->hsmscript == NULL) {
                /* no script enabled */
-               DEBUG(1, ("tsmsm_set_offline: No tsmsm:hsmscript configured\n"));
+               DEBUG(1, ("tsmsm_set_offline: No 'tsmsm:hsm script' configured\n"));
                return 0;
        }