comparison dvdauth.c @ 1510:9ffe6c1a33b9

In case the open on the dvd device fails, print some hints based on errno why the open has failed.
author jkeil
date Tue, 14 Aug 2001 12:17:38 +0000
parents f2516027a346
children
comparison
equal deleted inserted replaced
1509:f9beae70c5c2 1510:9ffe6c1a33b9
6 #ifdef HAVE_LIBCSS 6 #ifdef HAVE_LIBCSS
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 //#include <string.h> // FIXME: conflicts with fs.h 10 //#include <string.h> // FIXME: conflicts with fs.h
11 #include <errno.h>
11 #include <unistd.h> 12 #include <unistd.h>
12 #include <fcntl.h> 13 #include <fcntl.h>
13 #include <sys/types.h> 14 #include <sys/types.h>
14 #include <sys/ioctl.h> 15 #include <sys/ioctl.h>
15 #include <sys/stat.h> 16 #include <sys/stat.h>
74 * With the old libcss-0.1 api, we have to find out the LBA for 75 * With the old libcss-0.1 api, we have to find out the LBA for
75 * a title for title authentication. 76 * a title for title authentication.
76 */ 77 */
77 #ifdef __linux__ 78 #ifdef __linux__
78 #include <linux/fs.h> 79 #include <linux/fs.h>
79 #include <errno.h>
80 80
81 #ifndef FIBMAP 81 #ifndef FIBMAP
82 #define FIBMAP 1 82 #define FIBMAP 1
83 #endif 83 #endif
84 84
183 int dvd_auth ( char *dev , char *filename ) 183 int dvd_auth ( char *dev , char *filename )
184 { 184 {
185 DVDHandle dvd; /* DVD device handle */ 185 DVDHandle dvd; /* DVD device handle */
186 186
187 if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { 187 if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) {
188 fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev); 188 fprintf(stderr,"DVD: cannot open DVD device \"%s\": %s.\n",
189 dev, strerror(errno));
189 return 1; 190 return 1;
190 } 191 }
191 192
192 if (!CSSDVDisEncrypted(dvd)) { 193 if (!CSSDVDisEncrypted(dvd)) {
193 printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n"); 194 printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n");