@@ -431,6 +431,10 @@ int main(int ac, char **av)
fprintf(stderr, "%s is mounted\n", file);
exit(1);
}
+ if (ret == 2) {
+ fprintf(stderr, "%s is apparently in use by the system\n", file);
+ exit(1);
+ }
ac--;
fd = open(file, O_RDWR);
if (fd < 0) {
@@ -489,6 +493,10 @@ int main(int ac, char **av)
fprintf(stderr, "%s is mounted\n", file);
exit(1);
}
+ if (ret == 2) {
+ fprintf(stderr, "%s is apparently in use by the system\n", file);
+ exit(1);
+ }
fd = open(file, O_RDWR);
if (fd < 0) {
fprintf(stderr, "unable to open %s\n", file);
@@ -587,7 +587,7 @@ error:
}
/*
- * returns 1 if the device was mounted, < 0 on error or 0 if everything
+ * returns 2 if the device is busy, returns 1 if the device was
mounted, < 0 on error or 0 if everything
* is safe to continue. TODO, this should also scan multi-device filesystems
*/