Fixed checking whether the device is not already mounted

PERMISSION_HANDLING_BRANCH
Jean-Pierre André 2010-07-22 14:58:10 +02:00
parent 776117baf3
commit 04c561a0d1
2 changed files with 14 additions and 2 deletions

View File

@ -4344,6 +4344,7 @@ int main(int argc, char *argv[])
const char *permissions_mode = (const char*)NULL;
const char *failed_secure = (const char*)NULL;
struct stat sbuf;
unsigned long existing_mount;
int err, fd;
/*
@ -4383,7 +4384,12 @@ int main(int argc, char *argv[])
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
if (ntfs_check_if_mounted(opts.device,&existing_mount)
|| (existing_mount & NTFS_MF_MOUNTED)) {
err = NTFS_VOLUME_LOCKED;
goto err_out;
}
/* need absolute mount point for junctions */
if (opts.mnt_point[0] == '/')
ctx->abs_mnt_point = strdup(opts.mnt_point);

View File

@ -4291,6 +4291,7 @@ int main(int argc, char *argv[])
const char *permissions_mode = (const char*)NULL;
const char *failed_secure = (const char*)NULL;
struct stat sbuf;
unsigned long existing_mount;
int err, fd;
/*
@ -4330,7 +4331,12 @@ int main(int argc, char *argv[])
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
if (ntfs_check_if_mounted(opts.device,&existing_mount)
|| (existing_mount & NTFS_MF_MOUNTED)) {
err = NTFS_VOLUME_LOCKED;
goto err_out;
}
/* need absolute mount point for junctions */
if (opts.mnt_point[0] == '/')
ctx->abs_mnt_point = strdup(opts.mnt_point);