Mercurial > mplayer.hg
comparison fibmap_mplayer.c @ 1164:3367eba48763
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
author | lgb |
---|---|
date | Tue, 19 Jun 2001 00:05:27 +0000 |
parents | |
children | 5216f108cb4f |
comparison
equal
deleted
inserted
replaced
1163:ac1341d4a2a7 | 1164:3367eba48763 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 #include <unistd.h> | |
5 #include <fcntl.h> | |
6 #include <errno.h> | |
7 #include <sys/types.h> | |
8 #include <sys/ioctl.h> | |
9 #include <sys/stat.h> | |
10 | |
11 #ifndef FIBMAP | |
12 #define FIBMAP 1 | |
13 #endif | |
14 | |
15 int main ( int argc , char ** argv ) | |
16 { | |
17 int fd,lba=0; | |
18 if (argc!=2) { | |
19 printf("Bad usage.\n"); | |
20 return 1; | |
21 } | |
22 if ((fd = open(argv[1], O_RDONLY)) == -1) { | |
23 printf("Cannot open file %s: %s\n", | |
24 argv[1] ? argv[1] : "(NULL)", strerror(errno)); | |
25 return 1; | |
26 } | |
27 if (ioctl(fd, FIBMAP, &lba) != 0) { | |
28 printf("fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]); | |
29 close(fd); | |
30 return 1; | |
31 } | |
32 close(fd); | |
33 printf("%d\n",lba); | |
34 return 0; | |
35 } |