summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-04-28 15:11:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-04-28 15:11:29 (GMT)
commitd3b664b6a79508d78974a347a9d450e72defb76b (patch)
treec1d66801ef73f7b1cefbfccbbbe155e9de1b6914
parentc2729b6ad13170d7311848ecba2483515e113825 (diff)
downloadhdf5-d3b664b6a79508d78974a347a9d450e72defb76b.zip
hdf5-d3b664b6a79508d78974a347a9d450e72defb76b.tar.gz
hdf5-d3b664b6a79508d78974a347a9d450e72defb76b.tar.bz2
Changed the Windows POSIX open() file permissions to be correct
according to MSDN. Partial fix for HDFFV-9630.
-rw-r--r--src/H5Defl.c4
-rw-r--r--src/H5FDcore.c6
-rw-r--r--src/H5FDdirect.c2
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDsec2.c2
-rw-r--r--src/H5private.h18
-rw-r--r--src/H5win32defs.h3
-rw-r--r--test/big.c6
-rw-r--r--test/btree2.c8
-rw-r--r--test/dsets.c4
-rw-r--r--test/external.c8
-rw-r--r--test/file_image.c6
-rw-r--r--test/fillval.c2
-rw-r--r--test/h5test.c4
-rw-r--r--test/istore.c2
-rw-r--r--test/tfile.c12
-rw-r--r--test/twriteorder.c4
-rw-r--r--tools/src/h5jam/h5jam.c8
18 files changed, 60 insertions, 41 deletions
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 5536ba3..93bf2b2 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -288,7 +288,7 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
- if((fd = HDopen(full_name, O_RDONLY, 0)) < 0)
+ if((fd = HDopen(full_name, O_RDONLY, H5_POSIX_OPEN_MODE_0000)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file")
if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0)
HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file")
@@ -380,7 +380,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed")
if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0)
HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name")
- if((fd = HDopen(full_name, O_CREAT | O_RDWR, 0666)) < 0) {
+ if((fd = HDopen(full_name, O_CREAT | O_RDWR, H5_POSIX_OPEN_MODE_0666)) < 0) {
if(HDaccess(full_name, F_OK) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist")
else
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index d100a8b..6c22f69 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -638,7 +638,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
((file_image_info.buffer == NULL) && (file_image_info.size == 0)));
HDmemset(&sb, 0, sizeof(sb));
if((file_image_info.buffer != NULL) && !(H5F_ACC_CREAT & flags)) {
- if(HDopen(name, o_flags, 0666) >= 0)
+ if(HDopen(name, o_flags, H5_POSIX_OPEN_MODE_0666) >= 0)
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists")
/* If backing store is requested, create and stat the file
@@ -646,7 +646,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
* technically an open.
*/
if(fa->backing_store) {
- if((fd = HDopen(name, o_flags | O_CREAT, 0666)) < 0)
+ if((fd = HDopen(name, o_flags | O_CREAT, H5_POSIX_OPEN_MODE_0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file")
if(HDfstat(fd, &sb) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
@@ -656,7 +656,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
* store is off is when the backing_store flag is off and H5F_ACC_CREAT is
* on. */
else if(fa->backing_store || !(H5F_ACC_CREAT & flags)) {
- if((fd = HDopen(name, o_flags, 0666)) < 0)
+ if((fd = HDopen(name, o_flags, H5_POSIX_OPEN_MODE_0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if(HDfstat(fd, &sb) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 1487cda..79a5e8a 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -487,7 +487,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
o_flags |= O_DIRECT;
/* Open the file */
- if ((fd=HDopen(name, o_flags, 0666))<0)
+ if ((fd=HDopen(name, o_flags, H5_POSIX_OPEN_MODE_0666))<0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if (HDfstat(fd, &sb)<0)
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 75333c2..6e5a57b 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -520,7 +520,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HDgettimeofday(&timeval_start, NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Open the file */
- if((fd = HDopen(name, o_flags, 0666)) < 0) {
+ if((fd = HDopen(name, o_flags, H5_POSIX_OPEN_MODE_0666)) < 0) {
int myerrno = errno;
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 26913e2..71657b6 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -341,7 +341,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
o_flags |= O_EXCL;
/* Open the file */
- if((fd = HDopen(name, o_flags, 0666)) < 0) {
+ if((fd = HDopen(name, o_flags, H5_POSIX_OPEN_MODE_0666)) < 0) {
int myerrno = errno;
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x", name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
} /* end if */
diff --git a/src/H5private.h b/src/H5private.h
index c588154..fc15e99 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -495,6 +495,24 @@
# define H5_POSIX_MAX_IO_BYTES SSIZET_MAX
#endif
+/* POSIX I/O mode used as the fourth parameter to open/_open
+ * when creating a new file (O_CREAT is set).
+ *
+ * It's a little awkward to put the Unix file permissions
+ * in the symbol name, but that is what is most important
+ * and we only need the symbol to handle Windows' less-capable
+ * system.
+ */
+#if defined(H5_HAVE_WIN32_API)
+# define H5_POSIX_OPEN_MODE_0666 (_S_IREAD | _S_IWRITE)
+# define H5_POSIX_OPEN_MODE_0644 _S_IREAD
+# define H5_POSIX_OPEN_MODE_0000 0
+#else
+# define H5_POSIX_OPEN_MODE_0666 0666
+# define H5_POSIX_OPEN_MODE_0644 0644
+# define H5_POSIX_OPEN_MODE_0000 0000
+#endif
+
/*
* A macro to portably increment enumerated types.
*/
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 0149faa..771b6fc 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -48,7 +48,8 @@ typedef __int64 h5_stat_size_t;
#define HDnanosleep(N, O) Wnanosleep(N, O)
#define HDoff_t __int64
/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL
- * transformations when performing I/O.
+ * transformations when performing I/O. Note that this will
+ * produce Unix-style text files, though.
*/
#define HDopen(S,F,M) _open(S,F|_O_BINARY,M)
#define HDread(F,M,Z) _read(F,M,Z)
diff --git a/test/big.c b/test/big.c
index 3685821..274c00b 100644
--- a/test/big.c
+++ b/test/big.c
@@ -172,7 +172,7 @@ is_sparse(void)
int fd;
h5_stat_t sb;
- if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
+ if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_OPEN_MODE_0666)) < 0) return 0;
if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
@@ -210,7 +210,7 @@ supports_big(void)
int fd = -1;
fsizes_t fsize = NO_FILE;
- if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0)
+ if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_OPEN_MODE_0666)) < 0)
goto error;
/* Write a few byte at the beginning */
@@ -293,7 +293,7 @@ enough_room(hid_t fapl)
/* Create files */
for (i=0; i<NELMTS(fd); i++) {
HDsnprintf(name, sizeof(name), filename, i);
- if ((fd[i]=HDopen(name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) {
+ if ((fd[i]=HDopen(name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0) {
goto done;
}
if ((off_t)size != HDlseek(fd[i], (off_t)size, SEEK_SET)) {
diff --git a/test/btree2.c b/test/btree2.c
index ec3e20e..5d35cf2 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -8736,7 +8736,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Make a copy of the file in memory, in order to speed up deletion testing */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDONLY, 0)) < 0)
+ if((fd = HDopen(filename, O_RDONLY, H5_POSIX_OPEN_MODE_0000)) < 0)
TEST_ERROR
/* Retrieve the file's size */
@@ -8833,7 +8833,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
TEST_ERROR
/* Write file's data from memory */
@@ -8920,7 +8920,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
TEST_ERROR
/* Write file's data from memory */
@@ -9005,7 +9005,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
/* Re-write the file's data with the copy in memory */
/* Open the file just created */
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
TEST_ERROR
/* Write file's data from memory */
diff --git a/test/dsets.c b/test/dsets.c
index ef58509..4d2968e 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -569,7 +569,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if(H5Fclose(file) < 0) goto error;
file = -1;
- f = HDopen(filename, O_RDONLY, 0);
+ f = HDopen(filename, O_RDONLY, H5_POSIX_OPEN_MODE_0000);
HDlseek(f, (off_t)offset, SEEK_SET);
if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
@@ -683,7 +683,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) goto error;
file = -1;
- f = HDopen(filename, O_RDONLY, 0);
+ f = HDopen(filename, O_RDONLY, H5_POSIX_OPEN_MODE_0000);
HDlseek(f, (off_t)offset, SEEK_SET);
if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
diff --git a/test/external.c b/test/external.c
index 9502586..d911f36 100644
--- a/test/external.c
+++ b/test/external.c
@@ -59,9 +59,9 @@ files_have_same_contents(const char *name1, const char *name2)
char buf1[1024], buf2[1024];
hbool_t ret = FALSE; /* not equal until proven otherwise */
- if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0)
+ if((fd1 = HDopen(name1, O_RDONLY, H5_POSIX_OPEN_MODE_0666)) < 0)
goto out;
- if((fd2 = HDopen(name2, O_RDONLY, 0666)) < 0)
+ if((fd2 = HDopen(name2, O_RDONLY, H5_POSIX_OPEN_MODE_0666)) < 0)
goto out;
/* Loop until files are empty or we encounter a problem */
@@ -137,7 +137,7 @@ reset_raw_data_files(void)
/* Open file */
HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
goto error;
/* Write garbage data to the file. This allows us to test the
@@ -171,7 +171,7 @@ reset_raw_data_files(void)
/* Open file */
HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
- if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
goto error;
/* Write garbage data to the file. This allows us to test the
diff --git a/test/file_image.c b/test/file_image.c
index 90b3233..8702b06 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -624,7 +624,7 @@ test_core(void)
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE, "Free callback came from wrong sourc in core close");
/* Create file image buffer */
- fd = HDopen(copied_filename, O_RDONLY, 0666);
+ fd = HDopen(copied_filename, O_RDONLY, H5_POSIX_OPEN_MODE_0666);
VERIFY(fd > 0, "open failed");
ret = HDfstat(fd, &sb);
VERIFY(ret == 0, "fstat failed");
@@ -814,7 +814,7 @@ test_get_file_image(const char * test_banner,
HDsnprintf(member_file_name, 1024, file_name, i);
/* open the test file using standard I/O calls */
- fd = HDopen(member_file_name, O_RDONLY, 0666);
+ fd = HDopen(member_file_name, O_RDONLY, H5_POSIX_OPEN_MODE_0666);
VERIFY(fd >= 0, "HDopen() failed.");
if(size_remaining >= FAMILY_SIZE ){
@@ -862,7 +862,7 @@ test_get_file_image(const char * test_banner,
VERIFY(file_image_ptr != NULL, "HDmalloc(2) failed.");
/* open the test file using standard I/O calls */
- fd = HDopen(file_name, O_RDONLY, 0666);
+ fd = HDopen(file_name, O_RDONLY, H5_POSIX_OPEN_MODE_0666);
VERIFY(fd >= 0, "HDopen() failed.");
if(user) {
diff --git a/test/fillval.c b/test/fillval.c
index ea13de0..8f1f53d 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1890,7 +1890,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
hsize_t nelmts;
nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4];
- if((fd=HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0 ||
+ if((fd=HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0 ||
HDclose(fd) < 0) goto error;
if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0)
goto error;
diff --git a/test/h5test.c b/test/h5test.c
index 2d77dc8..a5cd674 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -1596,9 +1596,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
goto error;
/* Copy old file into temporary file */
- if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0)
+ if((fd_old = HDopen(filename, O_RDONLY, H5_POSIX_OPEN_MODE_0666)) < 0)
goto error;
- if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
+ if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666)) < 0)
goto error;
/* Copy data */
diff --git a/test/istore.c b/test/istore.c
index 8dc5efd..18cf1de 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -73,7 +73,7 @@ is_sparse(void)
int fd;
h5_stat_t sb;
- if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
+ if ((fd=HDopen("x.h5", O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_OPEN_MODE_0666)) < 0) return 0;
if (HDlseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
diff --git a/test/tfile.c b/test/tfile.c
index 7274c82..2d26874 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1611,7 +1611,7 @@ test_file_ishdf5(void)
/* Create non-HDF5 file and check it */
- fd=HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ fd=HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666);
CHECK(fd, FAIL, "HDopen");
/* Initialize information to write */
@@ -2657,7 +2657,7 @@ cal_chksum(const char *file, uint32_t *chksum)
herr_t ret; /* Generic return value */
/* Open the file */
- fdes = HDopen(file, O_RDONLY, 0);
+ fdes = HDopen(file, O_RDONLY, H5_POSIX_OPEN_MODE_0000);
CHECK(fdes, FAIL, "HDopen");
/* Retrieve the file's size */
@@ -2720,7 +2720,7 @@ test_rw_noupdate(void)
/* Calculate checksum for the file */
ret = cal_chksum(FILE1, &chksum1);
- CHECK(ret, FAIL, "HDopen");
+ CHECK(ret, FAIL, "cal_chksum");
/* Open and close File With Read/Write Permission */
fid = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -2732,7 +2732,7 @@ test_rw_noupdate(void)
/* Calculate checksum for the file */
ret = cal_chksum(FILE1, &chksum2);
- CHECK(ret, FAIL, "HDopen");
+ CHECK(ret, FAIL, "cal_chksum");
/* The two checksums are the same, i.e. the file is not changed */
VERIFY(chksum1, chksum2, "Checksum");
@@ -4340,9 +4340,9 @@ test_filespace_compatible(void)
const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */
/* Open and copy the test file into a temporary file */
- fd_old = HDopen(filename, O_RDONLY, 0666);
+ fd_old = HDopen(filename, O_RDONLY, H5_POSIX_OPEN_MODE_0666);
CHECK(fd_old, FAIL, "HDopen");
- fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_OPEN_MODE_0666);
CHECK(fd_new, FAIL, "HDopen");
/* Copy data */
diff --git a/test/twriteorder.c b/test/twriteorder.c
index 0e1d0d4..3ecd3e0 100644
--- a/test/twriteorder.c
+++ b/test/twriteorder.c
@@ -231,7 +231,7 @@ int create_wo_file(void)
int ret_code;
/* Create the data file */
- if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, 0664)) < 0) {
+ if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_OPEN_MODE_0666)) < 0) {
printf("WRITER: error from open\n");
return -1;
}
@@ -297,7 +297,7 @@ int read_wo_file(void)
char buffer[BLOCKSIZE_DFT];
/* Open the data file */
- if ((read_fd = HDopen(DATAFILE, O_RDONLY, 0)) < 0) {
+ if ((read_fd = HDopen(DATAFILE, O_RDONLY, H5_POSIX_OPEN_MODE_0000)) < 0) {
printf("READER: error from open\n");
return -1;
}
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 61de604..f41f8dc 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -292,7 +292,7 @@ main (int argc, const char *argv[])
H5Pclose(plist);
H5Fclose(ifile);
- ufid = HDopen(ub_file, O_RDONLY, 0);
+ ufid = HDopen(ub_file, O_RDONLY, H5_POSIX_OPEN_MODE_0000);
if(ufid < 0) {
error_msg("unable to open user block file \"%s\"\n", ub_file);
leave (EXIT_FAILURE);
@@ -307,7 +307,7 @@ main (int argc, const char *argv[])
fsize = (off_t)sbuf.st_size;
- h5fid = HDopen(input_file, O_RDONLY, 0);
+ h5fid = HDopen(input_file, O_RDONLY, H5_POSIX_OPEN_MODE_0000);
if(h5fid < 0) {
error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
HDclose (ufid);
@@ -325,7 +325,7 @@ main (int argc, const char *argv[])
h5fsize = (hsize_t)sbuf2.st_size;
if (output_file == NULL) {
- ofid = HDopen (input_file, O_WRONLY, 0);
+ ofid = HDopen (input_file, O_WRONLY, H5_POSIX_OPEN_MODE_0000);
if (ofid < 0) {
error_msg("unable to open output file \"%s\"\n", output_file);
@@ -335,7 +335,7 @@ main (int argc, const char *argv[])
}
}
else {
- ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ ofid = HDopen (output_file, O_WRONLY | O_CREAT | O_TRUNC, H5_POSIX_OPEN_MODE_0644);
if (ofid < 0) {
error_msg("unable to create output file \"%s\"\n", output_file);