[Debburn-changes] r711 - in cdrkit/trunk: . debian libusal

Eduard Bloch blade at alioth.debian.org
Fri Mar 16 00:52:53 CET 2007


Author: blade
Date: 2007-03-15 23:52:53 +0000 (Thu, 15 Mar 2007)
New Revision: 711

Modified:
   cdrkit/trunk/Changelog
   cdrkit/trunk/debian/changelog
   cdrkit/trunk/libusal/scsi-linux-sg.c
Log:
Warning on busy state because of mounted disk

Modified: cdrkit/trunk/Changelog
===================================================================
--- cdrkit/trunk/Changelog	2007-03-15 23:21:47 UTC (rev 710)
+++ cdrkit/trunk/Changelog	2007-03-15 23:52:53 UTC (rev 711)
@@ -18,6 +18,8 @@
   * wodim.1: "you have 4 seconds to abort ..."
   * defaults.c: Correct fallback to CDR_FIFOSIZE and correct error message
     on bad input.
+  * tell the user his device is busy on Linux because it's mounted,  after
+    looking at /proc/mounts
 
   [ Peter Samuelson ]
   * Clean up Linux-2.6 CD/DVD-R drive detection, clearer error messages.

Modified: cdrkit/trunk/debian/changelog
===================================================================
--- cdrkit/trunk/debian/changelog	2007-03-15 23:21:47 UTC (rev 710)
+++ cdrkit/trunk/debian/changelog	2007-03-15 23:52:53 UTC (rev 711)
@@ -9,6 +9,8 @@
     + LFS support in UDF (closes: #411178, #401988)
     + transfer size extraction fix (part of #407773)
     + default gracetime value changed in recommendations (closes: #408844)
+    + telling the user when the drive is mounted and therefore busy
+      (closes: #414271)
   * Relaxed version dependency of cmake (closes: #407163)
 
  -- Eduard Bloch <blade at debian.org>  Fri, 19 Jan 2007 08:54:05 +0100

Modified: cdrkit/trunk/libusal/scsi-linux-sg.c
===================================================================
--- cdrkit/trunk/libusal/scsi-linux-sg.c	2007-03-15 23:21:47 UTC (rev 710)
+++ cdrkit/trunk/libusal/scsi-linux-sg.c	2007-03-15 23:52:53 UTC (rev 711)
@@ -252,7 +252,7 @@
 
 {
        int f;
-       int i;
+       int i=0;
        f = open(device, mode|O_EXCL);
        /* try to reopen locked/busy devices up to five times */
        for (i = 0; (i < 5) && (f == -1 && errno == EBUSY); i++) {
@@ -262,6 +262,19 @@
 	       usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
 	       f = open(device, mode|O_EXCL);
        }
+       if(i==5) {
+	       FILE *g = fopen("/proc/mounts", "r");
+	       if(g) {
+		       char buf[80];
+		       unsigned int len=strlen(device);
+		       while(!feof(g) && !ferror(g)) {
+			       if(fgets(buf, 79, g) && 0==strncmp(device, buf, len)) {
+				       fprintf(stderr, "WARNING: %s seems to be mounted!\n", device);
+			       }
+		       }
+		       fclose(g);
+	       }
+       }
        return f;
 }
 




More information about the Debburn-changes mailing list