summaryrefslogtreecommitdiffstats
path: root/fibmap_mplayer.c
diff options
context:
space:
mode:
authorlgb <lgb@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-19 00:05:27 +0000
committerlgb <lgb@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-19 00:05:27 +0000
commit17c95af77a5fb419d323b86250ba481902c1655b (patch)
tree7e6faf746b8d02b8113e1f33b60b259aa2f84542 /fibmap_mplayer.c
parent8f22850c73c92b4fde1ae090c6c88c05ebf5a008 (diff)
downloadmpv-17c95af77a5fb419d323b86250ba481902c1655b.tar.bz2
mpv-17c95af77a5fb419d323b86250ba481902c1655b.tar.xz
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 ;-)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1165 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'fibmap_mplayer.c')
-rw-r--r--fibmap_mplayer.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fibmap_mplayer.c b/fibmap_mplayer.c
new file mode 100644
index 0000000000..895f3f9a22
--- /dev/null
+++ b/fibmap_mplayer.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+
+#ifndef FIBMAP
+#define FIBMAP 1
+#endif
+
+int main ( int argc , char ** argv )
+{
+ int fd,lba=0;
+ if (argc!=2) {
+ printf("Bad usage.\n");
+ return 1;
+ }
+ if ((fd = open(argv[1], O_RDONLY)) == -1) {
+ printf("Cannot open file %s: %s\n",
+ argv[1] ? argv[1] : "(NULL)", strerror(errno));
+ return 1;
+ }
+ if (ioctl(fd, FIBMAP, &lba) != 0) {
+ printf("fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
+ close(fd);
+ return 1;
+ }
+ close(fd);
+ printf("%d\n",lba);
+ return 0;
+}