diff options
author | Jeremy Allison <jra@samba.org> | 2014-12-07 19:50:54 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2014-12-18 21:30:05 +0100 |
commit | de99f7e27d8dac54fbed751e479e8bad0a57e091 (patch) | |
tree | da4a113615f3ab5df81da9d504fe1e446a8770e1 /source3 | |
parent | 0ad2013d90bc923d8eeb4b5ed3010224fa2d1e86 (diff) | |
download | samba-de99f7e27d8dac54fbed751e479e8bad0a57e091.tar.gz |
s3: modules: Fix *allocate* calls to follow POSIX error return convention.
Fix up the time_audit and streams_xattr modules to follow
the -1,errno convention for errors.
Reported by Jones <jones.kstw@gmail.com> who provided the
initial patch. This patch tested and confirmed working
by him as well.
Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_streams_xattr.c | 5 | ||||
-rw-r--r-- | source3/modules/vfs_time_audit.c | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index c4d86ee6852..625e9957e0c 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -1027,11 +1027,12 @@ static int streams_xattr_fallocate(struct vfs_handle_struct *handle, } if (!streams_xattr_recheck(sio)) { - return errno; + return -1; } /* Let the pwrite code path handle it. */ - return ENOSYS; + errno = ENOSYS; + return -1; } diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 95b4148232b..4b9aef0c060 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1210,18 +1210,24 @@ static int smb_time_audit_fallocate(vfs_handle_struct *handle, off_t len) { int result; + int saved_errno = 0; struct timespec ts1,ts2; double timediff; clock_gettime_mono(&ts1); result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len); + if (result == -1) { + saved_errno = errno; + } clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; if (timediff > audit_timeout) { smb_time_audit_log_fsp("fallocate", timediff, fsp); } - + if (result == -1) { + errno = saved_errno; + } return result; } |