chiark
/
gitweb
/
~mdw
/
dvdrip
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
32c8d77
)
dvd-sector-copy.c: Add option to verify source id.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 6 Mar 2022 20:34:50 +0000
(20:34 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sun, 6 Mar 2022 20:34:50 +0000
(20:34 +0000)
dvd-sector-copy.c
patch
|
blob
|
blame
|
history
diff --git
a/dvd-sector-copy.c
b/dvd-sector-copy.c
index ea34461fd3d80e75a9d5ab0b1d91498f47dacef9..2017689fcbaeb9f19f2d93e0d7c360a2536b8800 100644
(file)
--- a/
dvd-sector-copy.c
+++ b/
dvd-sector-copy.c
@@
-3,7
+3,7
@@
static void usage(FILE *fp)
{
fprintf(fp,
static void usage(FILE *fp)
{
fprintf(fp,
- "usage: %s [-c] [-B PARAM=VALUE,...] [-R MAP]\n"
+ "usage: %s [-c
i
] [-B PARAM=VALUE,...] [-R MAP]\n"
"\t[-b OUTMAP] [-r [START]-[END]] DEVICE OUTFILE\n",
prog);
}
"\t[-b OUTMAP] [-r [START]-[END]] DEVICE OUTFILE\n",
prog);
}
@@
-955,7
+955,8
@@
int main(int argc, char *argv[])
struct timeval tv0, tv1;
double t, rate, tot;
const char *rateunit, *totunit;
struct timeval tv0, tv1;
double t, rate, tot;
const char *rateunit, *totunit;
- char timebuf[TIMESTRMAX];
+ char timebuf[TIMESTRMAX], id_in[MAXIDSZ], id_out[MAXIDSZ];
+ dvd_reader_t *dvd_out;
struct stat st;
#ifdef DEBUG
const struct file *file;
struct stat st;
#ifdef DEBUG
const struct file *file;
@@
-966,11
+967,12
@@
int main(int argc, char *argv[])
#define f_continue 2u
#define f_fixup 4u
#define f_stats 8u
#define f_continue 2u
#define f_fixup 4u
#define f_stats 8u
+#define f_checkid 16u
#define f_write 256u
set_prog(argv[0]);
for (;;) {
#define f_write 256u
set_prog(argv[0]);
for (;;) {
- opt = getopt(argc, argv, "hB:E:FR:X:b:cr:s"); if (opt < 0) break;
+ opt = getopt(argc, argv, "hB:E:FR:X:b:c
i
r:s"); if (opt < 0) break;
switch (opt) {
case 'h': usage(stderr); exit(0);
case 'B':
switch (opt) {
case 'h': usage(stderr); exit(0);
case 'B':
@@
-1109,6
+1111,16
@@
int main(int argc, char *argv[])
bail("device `%s' volume size %"PRIu64" not a multiple of %d",
device, volsz, SECTORSZ);
bail("device `%s' volume size %"PRIu64" not a multiple of %d",
device, volsz, SECTORSZ);
+ if (f&f_checkid) {
+ open_dvd(outfile, 0, &dvd_out);
+ if (dvd_id(id_in, dvd, DIF_MUSTIFOHASH, device) ||
+ dvd_id(id_out, dvd_out, DIF_MUSTIFOHASH, device))
+ exit(2);
+ if (STRCMP(id_in, !=, id_out))
+ bail("DVD id mismatch: input `%s' is `%s'; output `%s' is `%s'",
+ device, id_in, outfile, id_out);
+ }
+
outfd = open(outfile, O_WRONLY | O_CREAT, 0666);
if (outfd < 0)
bail_syserr(errno, "failed to create output file `%s'", outfile);
outfd = open(outfile, O_WRONLY | O_CREAT, 0666);
if (outfd < 0)
bail_syserr(errno, "failed to create output file `%s'", outfile);