]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
HTSP: Use lseek() + read() instead of pread()
authorAndreas Öman <andreas@lonelycoder.com>
Thu, 15 Nov 2012 12:25:23 +0000 (13:25 +0100)
committerAndreas Öman <andreas@lonelycoder.com>
Thu, 15 Nov 2012 12:25:23 +0000 (13:25 +0100)
Does not build out-of-the-box on lucid otherwise

src/htsp_server.c

index f2db2617ed973762d3b5b14b741adcc3d79ed64c..fa1376869a9aac3a2ce1a5f3b08285c5f9447992 100644 (file)
@@ -1345,11 +1345,14 @@ htsp_method_file_read(htsp_connection_t *htsp, htsmsg_t *in)
   if(hf == NULL)
     return htsp_error("Unknown file id");
 
+  if(lseek(hf->hf_fd, off, SEEK_SET) != off)
+    return htsp_error("Seek error");
+
   void *m = malloc(size);
   if(m == NULL)
     return htsp_error("Too big segment");
 
-  int r = pread(hf->hf_fd, m, size, off);
+  int r = read(hf->hf_fd, m, size);
   if(r < 0) {
     free(m);
     return htsp_error("Read error");