diff --git a/ntfsprogs/ntfsck.c b/ntfsprogs/ntfsck.c index 5fb1ddd3..b030af75 100644 --- a/ntfsprogs/ntfsck.c +++ b/ntfsprogs/ntfsck.c @@ -198,7 +198,7 @@ static BOOL verify_boot_sector(struct ntfs_device *dev) current_mft_record = 9; - if (dev->d_ops->pread(dev, buf, sizeof(buf), 0)!=sizeof(buf)) { + if (ntfs_pread(dev, 0, sizeof(buf), buf) != sizeof(buf)) { check_failed("Failed to read boot sector.\n"); return 1; } @@ -260,7 +260,8 @@ static runlist *load_runlist(struct ntfs_device *dev, s64 offset_to_file_record, if (!buf) return NULL; - if (dev->d_ops->pread(dev, buf, size_of_file_record, offset_to_file_record)!=size_of_file_record) { + if (ntfs_pread(dev, offset_to_file_record, size_of_file_record, buf) != + size_of_file_record) { check_failed("Failed to read file record at offset %lld (0x%llx).\n", offset_to_file_record, offset_to_file_record); return NULL; } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 75231fa3..930efbd1 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -421,9 +421,17 @@ static void parse_options(int argc, char **argv) if (S_ISBLK(st.st_mode)) { opt.blkdev_out = 1; - if (opt.metadata) + if (opt.metadata && !opt.force) err_exit("Cloning only metadata to a " - "block device isn't supported!\n"); + "block device does not usually " + "make sense, aborting...\n" + "If you were instructed to do " + "this by a developer and/or are " + "sure that this is what you want " + "to do, run this utility again " + "but this time add the force " + "option, i.e. add '--force' to " + "the command line arguments."); } } } @@ -522,6 +530,8 @@ static int io_all(void *fd, void *buf, int count, int do_write) if (i < 0) { if (errno != EAGAIN && errno != EINTR) return -1; + } else if (i == 0 && !do_write && opt.restore_image) { + return -1; } else { count -= i; buf = i + (char *) buf; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 35e3343f..448aa796 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -87,7 +87,6 @@ static struct options { const char *device; /* Device/File to work with */ const char *filename; /* Resolve this filename to mft number */ s64 inode; /* Info for this inode */ - int debug; /* Debug output */ int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ @@ -137,9 +136,6 @@ static void usage(void) " -v, --verbose More output\n" " -V, --version Display version information\n" " -h, --help Display this help\n" -#ifdef DEBUG - " -d, --debug Show debug information\n" -#endif "\n", EXEC_NAME); printf("%s%s\n", ntfs_bugs, ntfs_home); @@ -158,9 +154,6 @@ static int parse_options(int argc, char *argv[]) { static const char *sopt = "-:dfhi:F:mqtTvV"; static const struct option lopt[] = { -#ifdef DEBUG - { "debug", no_argument, NULL, 'd' }, -#endif { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, @@ -192,9 +185,6 @@ static int parse_options(int argc, char *argv[]) else err++; break; - case 'd': - opts.debug++; - break; case 'i': if ((opts.inode != -1) || (!utils_parse_size(optarg, &opts.inode, FALSE))) { @@ -280,7 +270,7 @@ static int parse_options(int argc, char *argv[]) err++; } - if ((opts.inode == -1) && (opts.filename == NULL) && !opts.mft) { + if (opts.inode == -1 && !opts.filename && !opts.mft) { if (argc > 1) ntfs_log_error("You must specify an inode to " "learn about.\n"); @@ -302,14 +292,6 @@ static int parse_options(int argc, char *argv[]) } -#ifdef DEBUG - if (!opts.debug) - if (!freopen("/dev/null", "w", stderr)) { - ntfs_log_perror("Failed to freopen stderr to /dev/null"); - exit(1); - } -#endif - if (ver) version(); if (help || err)