summaryrefslogtreecommitdiffstats
path: root/tools/misc/h5repart.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2009-12-26 08:36:37 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2009-12-26 08:36:37 (GMT)
commitf40a245ce239b9597efa815d70d1d9f005fbafdc (patch)
treed80f84b7a067f8ef634f0839d2d135d487d3e5eb /tools/misc/h5repart.c
parent840e04ab5f5ce7fa5d07a3c9187944c27f9534e9 (diff)
downloadhdf5-f40a245ce239b9597efa815d70d1d9f005fbafdc.zip
hdf5-f40a245ce239b9597efa815d70d1d9f005fbafdc.tar.gz
hdf5-f40a245ce239b9597efa815d70d1d9f005fbafdc.tar.bz2
[svn-r18055] Bug fix: 1192
Description: Fixed exit code (sometimes return code in Main) to follow the HDF5 standards. Tested: H5committested plus serial test in Jam.
Diffstat (limited to 'tools/misc/h5repart.c')
-rw-r--r--tools/misc/h5repart.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 91df7b6..2374059 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -98,7 +98,7 @@ usage (const char *progname)
"`k' for kB.\n");
fprintf(stderr, "File family names include an integer printf "
"format such as `%%d'\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
@@ -262,12 +262,12 @@ main (int argc, char *argv[])
if ((src=HDopen(src_name, O_RDONLY,0))<0) {
perror (src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDfstat(src, &sb)<0) {
perror ("fstat");
- exit (1);
+ exit (EXIT_FAILURE);
}
src_size = src_act_size = sb.st_size;
if (verbose) fprintf (stderr, "< %s\n", src_name);
@@ -282,7 +282,7 @@ main (int argc, char *argv[])
if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
perror (dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (verbose) fprintf (stderr, "> %s\n", dst_name);
@@ -308,10 +308,10 @@ main (int argc, char *argv[])
n = (size_t)MIN ((off_t)n, src_act_size-src_offset);
if ((nio=HDread (src, buf, n))<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
} else if ((size_t)nio!=n) {
fprintf (stderr, "%s: short read\n", src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
for (i=0; i<n; i++) {
if (buf[i]) break;
@@ -331,14 +331,14 @@ main (int argc, char *argv[])
if (need_write) {
if (need_seek && HDlseek (dst, dst_offset, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if ((nio=HDwrite (dst, buf, n))<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
} else if ((size_t)nio!=n) {
fprintf (stderr, "%s: short write\n", dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
need_seek = FALSE;
} else {
@@ -366,11 +366,11 @@ main (int argc, char *argv[])
break;
} else if (src<0) {
perror (src_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDfstat (src, &sb)<0) {
perror ("fstat");
- exit (1);
+ exit (EXIT_FAILURE);
}
src_act_size = sb.st_size;
if (src_act_size>src_size) {
@@ -391,26 +391,26 @@ main (int argc, char *argv[])
if (0==dst_membno) {
if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
perror ("HDHDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDread (dst, buf, 1)<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDlseek (dst, dst_size-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDwrite (dst, buf, 1)<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
HDclose (dst);
sprintf (dst_name, dst_gen_name, ++dst_membno);
if ((dst=HDopen (dst_name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
perror (dst_name);
- exit (1);
+ exit (EXIT_FAILURE);
}
dst_offset = 0;
need_seek = FALSE;
@@ -426,19 +426,19 @@ main (int argc, char *argv[])
if (need_seek) {
if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDread (dst, buf, 1)<0) {
perror ("read");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
perror ("HDlseek");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (HDwrite (dst, buf, 1)<0) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
HDclose (dst);
@@ -447,7 +447,7 @@ main (int argc, char *argv[])
* These private properties are for this tool only. */
if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) {
perror ("H5Pcreate");
- exit (1);
+ exit (EXIT_FAILURE);
}
if(family_to_sec2) {
@@ -456,7 +456,7 @@ main (int argc, char *argv[])
* driver information saved in the superblock. */
if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) {
perror ("H5Pset");
- exit (1);
+ exit (EXIT_FAILURE);
}
} else {
/* Modify family size saved in superblock through private property. It signals
@@ -464,14 +464,14 @@ main (int argc, char *argv[])
* This private property is for this tool only. */
if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
perror ("H5Pset_fapl_family");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Set the property of the new member size as hsize_t */
hdsize = dst_size;
if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
perror ("H5Pset");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -488,16 +488,16 @@ main (int argc, char *argv[])
if(file>=0) {
if(H5Fclose(file)<0) {
perror ("H5Fclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
if(H5Pclose(fapl)<0) {
perror ("H5Pclose");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Free resources and return */
free (buf);
- return 0;
+ return EXIT_SUCCESS;
}