From 61aa3a26d6578e308cae8d5ae0bbe3a87cbe684e Mon Sep 17 00:00:00 2001 From: ericm Date: Fri, 22 Aug 2003 15:03:04 +0000 Subject: [PATCH] merge b_devel -> b_eq: 20030822 --- lustre/tests/openunlink.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/lustre/tests/openunlink.c b/lustre/tests/openunlink.c index 96632a9..26bfe79 100644 --- a/lustre/tests/openunlink.c +++ b/lustre/tests/openunlink.c @@ -1,3 +1,6 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + */ #include #include #include @@ -44,44 +47,30 @@ int main(int argc, char **argv) } if (argc == 3) { - fprintf(stderr, "closing %s\n", fname); - rc = close(fd); - if (rc) { - fprintf(stderr, "close (normal) %s\n", strerror(errno)); - exit(1); - } - - fprintf(stderr, "opening %s\n", fname2); - fd = open(fname2, O_RDWR); - if (fd == -1) { - fprintf(stderr, "open (unlink) %s\n", strerror(errno)); - exit(1); - } - fprintf (stderr, "unlinking %s\n", fname2); rc = unlink(fname2); if (rc) { fprintf(stderr, "unlink %s\n", strerror(errno)); exit(1); } - - if (access(fname2, F_OK) == 0) { - fprintf(stderr, "%s still exists\n", fname2); - exit(1); - } } else { - fprintf(stderr, "resetting fd offset\n"); - rc = lseek(fd, 0, SEEK_SET); - if (rc) { - fprintf(stderr, "seek %s\n", strerror(errno)); - exit(1); - } - printf("unlink %s and press enter\n", fname); getc(stdin); } if (access(fname, F_OK) == 0) { + fprintf(stderr, "%s still exists\n", fname2); + exit(1); + } + + fprintf(stderr, "resetting fd offset\n"); + rc = lseek(fd, 0, SEEK_SET); + if (rc) { + fprintf(stderr, "seek %s\n", strerror(errno)); + exit(1); + } + + if (access(fname, F_OK) == 0) { fprintf(stderr, "%s still exists\n", fname); exit(1); } -- 1.8.3.1