From: Jeremy Allison Date: Mon, 8 Dec 2014 03:50:54 +0000 (-0800) Subject: s3: modules: Fix *allocate* calls to follow POSIX error return convention. X-Git-Tag: samba-4.0.26~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de99f7e27d8dac54fbed751e479e8bad0a57e091;p=thirdparty%2Fsamba.git 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 who provided the initial patch. This patch tested and confirmed working by him as well. Signed-off-by: Jeremy Allison --- 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; }