summaryrefslogtreecommitdiff
path: root/source3/include/includes.h
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-03 08:02:41 +0000
committerJeremy Allison <jra@samba.org>2002-12-03 08:02:41 +0000
commit6a019636b980857cf896f250841de757644ba9dd (patch)
treea55c969f53624d123c5743cd655588128356dfa5 /source3/include/includes.h
parent1c8e1e04480c5c050a0112ac70f3e66fab80ebba (diff)
downloadsamba-6a019636b980857cf896f250841de757644ba9dd.tar.gz
samba-6a019636b980857cf896f250841de757644ba9dd.tar.bz2
samba-6a019636b980857cf896f250841de757644ba9dd.zip
Fixed nasty bug where file writes with start offsets in the range
0x80000000 -> 0xFFFFFFFF would fail as they were being cast from IVAL (uint32) to SMB_OFF_T (off_t or off64_t, both *signed* types). The sign extension would cause the offset to be treated as negative. Thanks to Herb for helping me track this one down (IRIX is good for large file tests :-). Jeremy. PS. That horrid EXEXIST thing has broken configure..... (This used to be commit 2d14c442bc601a277458b69f05a763aa2a1ab3b7)
Diffstat (limited to 'source3/include/includes.h')
-rw-r--r--source3/include/includes.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 41eda71554..395b456fba 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -589,9 +589,11 @@ typedef int socklen_t;
#ifdef LARGE_SMB_OFF_T
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
+#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
#else
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
+#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
#endif
/*