[Ocfs2-tools-devel] [PATCH 4/5] Ocfs2-test: Fix 2 minor bugs for open_delete.c
Tristan Ye
tristan.ye at oracle.com
Wed Sep 17 01:48:49 PDT 2008
1.Truncate strcmp operation in the beginning of parse_opts,otherwise it
will cause a segmentation fault error under openmpi environment when we
leave all arguments empty.
2.Make the filename as a constant one.if it was postfixed with the
node's hostname,will definitely hit a bug when we only got 2 banks among
2 nodes:the created file will never be deleted!
For this test,we have rank0 do the file creation,and the rest
ranks take a race to delete,am I making a wrong understanding?
3.Adjust the error print to show us the real error string and ret code.
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
programs/open_delete/open_delete.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/programs/open_delete/open_delete.c b/programs/open_delete/open_delete.c
index e89a2a8..8bf98eb 100644
--- a/programs/open_delete/open_delete.c
+++ b/programs/open_delete/open_delete.c
@@ -76,8 +76,6 @@ static int parse_opts(int argc, char **argv)
{
int c;
- if (strcmp(argv[1],"-h") == 0)
- return EINVAL;
while (1) {
c = getopt(argc, argv, "i:");
if (c == -1)
@@ -127,6 +125,7 @@ open_after:
ret = unlink(filename);
if ( ret ) {
+ ret = errno;
printf("%s (rank %d): ", hostname, rank);
printf("Error %d deleteing file \"%s\": %s\n",
ret, filename, strerror(ret));
@@ -175,7 +174,7 @@ int main(int argc, char *argv[])
}
strcat(filename, "_");
- strcat(filename, hostname);
+ strcat(filename, "open_and_delete-test-file");
ret = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (ret != MPI_SUCCESS)
--
1.5.5
More information about the Ocfs2-tools-devel
mailing list