diff options
author | Xuan Bai <xuanbai@hdfgroup.org> | 2005-01-05 20:40:35 (GMT) |
---|---|---|
committer | Xuan Bai <xuanbai@hdfgroup.org> | 2005-01-05 20:40:35 (GMT) |
commit | 98a21295612013bf9679a6bfe923312c7d5b1886 (patch) | |
tree | 7e2384ed276df6d98fd99884d88d4cb5dcf4c524 | |
parent | 101a363b2de0a90f81ab06db5614ee48d26c2039 (diff) | |
download | hdf5-98a21295612013bf9679a6bfe923312c7d5b1886.zip hdf5-98a21295612013bf9679a6bfe923312c7d5b1886.tar.gz hdf5-98a21295612013bf9679a6bfe923312c7d5b1886.tar.bz2 |
[svn-r9750] Purpose:
Bug fix.
Description:
creat(name, (mode_t)0777) is used to create a new file. However, creat() is not available in Visual Studio.
Solution:
Use a Win32 macro so _creat() will be used on Windows and creat() will be used on Unix. #ifdef WIN32 fd = _creat(name, _S_IREAD | _S_IWRITE); #else /* WIN32 */ fd = creat(name,(mode_t)0777); #endif /* WIN32 */ (Note: At first, I tried to define HDcreat() as _creat() for WIN32 and creat() for other platforms in H5private.h. But _creat() and creat() use different parameters for file permission settings. So, I added the WIN32 macro in h5jamgentest.c.)
Platforms tested:
Linux 2.4 (Heping)
Visual C++ 6.0 on Windows XP/2000.
.NET on Windows XP.
(Tested with SZIP-with-encoder and SZIP-without-encoder).
Misc. update:
-rw-r--r-- | tools/h5jam/h5jamgentest.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 2d5f253..c3981a4 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -551,7 +551,12 @@ int fd; size_t i; char *bp; + + #ifdef WIN32 + fd = _creat(name, _S_IREAD | _S_IWRITE); + #else /* WIN32 */ fd = creat(name,(mode_t)0777); + #endif /* WIN32 */ if (fd < 0) { /* panic */ } @@ -580,6 +585,7 @@ int fd; int i; char *bp; + fd = creat(name,0777); if (fd < 0) { /* panic */ |