From 1e860e6536c64112e691274dfec6538effa57ab9 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 18 Apr 2007 21:31:21 +0000 Subject: [PATCH] Adaptations to new test results and discussions --- libburn/trunk/doc/ddlp.txt | 3 ++- libburn/trunk/test/open-cd-excl.c | 11 +++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libburn/trunk/doc/ddlp.txt b/libburn/trunk/doc/ddlp.txt index 69763a55..4635f5c1 100644 --- a/libburn/trunk/doc/ddlp.txt +++ b/libburn/trunk/doc/ddlp.txt @@ -154,7 +154,8 @@ device files with combinations of read-write, O_EXCL, and fcntl(). (This does not mean that Ted endorsed our project yet. He helps exploring.) Friendly in the sense of DDLP-A would be any run which uses at least one of -the options -e (i.e. O_EXCL) or -f (i.e. F_SETLK). +the options -e (i.e. O_EXCL) or -f (i.e. F_SETLK, applied to a file +descriptor which was obtained from a standard device file path). The code is available under GPL at http://libburnia.pykix.org/browser/libburn/trunk/test/open-cd-excl.c?format=txt To be compiled by diff --git a/libburn/trunk/test/open-cd-excl.c b/libburn/trunk/test/open-cd-excl.c index 80efae00..fffe4d0d 100644 --- a/libburn/trunk/test/open-cd-excl.c +++ b/libburn/trunk/test/open-cd-excl.c @@ -109,16 +109,10 @@ int main(int argc, char **argv) printf("fcntl lock apparently %sLOCKED\n", (fl.l_type == F_UNLCK) ? "NOT " : ""); - /* ts A70418: do not try to lock if it is already locked */ - if (fl.l_type != F_UNLCK) { - printf("failed\n"); - exit(1); - } - init_flock(&fl, do_rdwr); printf("Trying to grab fcntl lock...\n"); - if (fcntl(fd, F_SETLKW, &fl) < 0) { - perror("fcntl: F_SETLKW: "); + if (fcntl(fd, F_SETLK, &fl) < 0) { + perror("fcntl: F_SETLK: "); printf("failed\n"); exit(1); } @@ -127,6 +121,7 @@ int main(int argc, char **argv) /* ts A70417: added end_immediately */ printf("Holding %s open.\n", device_name); + usleep(100000); if (end_immediately) exit(0); printf("Press ^C to exit.\n");