diff options
author | Xuan Bai <xuanbai@hdfgroup.org> | 2005-01-05 16:34:04 (GMT) |
---|---|---|
committer | Xuan Bai <xuanbai@hdfgroup.org> | 2005-01-05 16:34:04 (GMT) |
commit | 4707b280f8927422112a698ac69ded9b40f529a2 (patch) | |
tree | 61db8c036a530a7e43dfd9487de2369391090f36 /tools | |
parent | 63f32322e8f512acbf95d2372bcbfa2c4a375054 (diff) | |
download | hdf5-4707b280f8927422112a698ac69ded9b40f529a2.zip hdf5-4707b280f8927422112a698ac69ded9b40f529a2.tar.gz hdf5-4707b280f8927422112a698ac69ded9b40f529a2.tar.bz2 |
[svn-r9746] 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:
Heping (Linux)
Visual C++ 6.0 on Windows XP/2000.
.NET on Windows XP.
(Tested with SZIP-with-encoder and SZIP-without-encoder).
Misc. update:
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5jam/h5jamgentest.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 2d5f253..ada206b 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -551,7 +551,11 @@ 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 */ } |